Help: Send Messages to Client with ESP8266's

So, im making something where there are two esp’s, one an access point and the other a client, and your computer is supposed to join the esp network. The goal of this being to send both esp’s information to the computer. Since I cant figure out how to do client to client communication, I have decided to send the client esp’s information to the access point esp, and have that send information to the computer on behalf of the other esp. I want the information to be sent to the computer, but since I dont know how to single out the computer, and doing so may take too much time, I have decided to send the message to all clients. Im on a script made by the I2cdev library where I use FIFO stuff, essentially my code cant take too long or else it will get jammed up and overflow. Im using code in c# on my computer in unity to pick up the data. The way ive been doing it is making a list of all clients and sending to each one using client.println(), since my c# code is able to pick this up. Yet when I added the feature of sending the other esp’s information it took too long and overflowed. The main culprit being the messaging system. I found a quick enough solution in the docs where I could do server.println() to send to all clients, yet my c# code cant pick this up. So i need to find a way to get c# to recognize server.println() so my code can go through. The code for my access point esp is attatched, with the function msgAllClients() being the overflow culprit, along with the c# code to recieve in unity. I felt as thogh the right controller is not needed but I can add if requested because maybe one of my assumptions was wrong, like how client to client communication may be possible. Any help is appreciated, and thank you guys so much! =)

LeftControllerV1.ino (12.1 KB)

ClientSocket.zip (1.54 KB)

WiFi network roles AP and STA are in no relation to TCP/IP network communication roles like server and client. a device forming the network as AP can be a client to server running on one of the stations in that network

Juraj:
wifi - How to acheive fast and reliable communication between NodeMCUs? - Arduino Stack Exchange

WiFi network roles AP and STA are in no relation to TCP/IP network communication roles like server and client. a device forming the network as AP can be a client to server running on one of the stations in that network

Thanks for the response! Forgive me for I am new to the subject, but how may I use this information to solve the problem im having? If you can, some code would be very much appreciated. =)

probablyhuman:
Thanks for the response! Forgive me for I am new to the subject, but how may I use this information to solve the problem im having? If you can, some code would be very much appreciated. =)

visit the link

Hmm, I thought that server.available() only returned one client connected to the server. So its saying that if I write something to the result of server.available() it will send a message to all the WiFiClients? Unless I misinterpreted it. What im doing right now is compiling a list of clients that server.available() gives me, and then seeing if a item in the list has the same ip as the new client, and then not adding it. Then i can send an item to each of the clients in the list, yet this takes too long. But if server.available() returns a client that sort-of represents all clients on the network, then i dont have to make a list of them! =)

probablyhuman:
Hmm, I thought that server.available() only returned one client connected to the server. So its saying that if I write something to the result of server.available() it will send a message to all the WiFiClients? Unless I misinterpreted it. What im doing right now is compiling a list of clients that server.available() gives me, and then seeing if a item in the list has the same ip as the new client, and then not adding it. Then i can send an item to each of the clients in the list, yet this takes too long. But if server.available() returns a client that sort-of represents all clients on the network, then i dont have to make a list of them! =)

server represent all clients. server.write or server.print should send data to all clients, but it is not implemented in the ESP8266WiFi library.
why would sending to all clients take too long?

I have no idea. Just whenever I re-implement the msgAllClients() function, I start getting FIFO Overflows because its taking too long. Do you know any thing i could implement that would act like server.print() or server.write()? Or maybe I just implemented it poorly and ineffectivley and thats why its taking too long. Do you think you could improve my function? I seem to be at a loss. lol

probablyhuman:
I have no idea. Just whenever I re-implement the msgAllClients() function, I start getting FIFO Overflows because its taking too long. Do you know any thing i could implement that would act like server.print() or server.write()? Or maybe I just implemented it poorly and ineffectivley and thats why its taking too long. Do you think you could improve my function? I seem to be at a loss. lol

you will get nowhere by taking workarounds on workarounds.

let the loop() loop while handling clients. or call yield() to let the SDK handle the WiFi
https://arduino-esp8266.readthedocs.io/en/latest/reference.html?highlight=delay#timing-and-delays

I dont think i have enough time to put in calls for delays and do all my other functions at the same time.

probablyhuman:
I dont think i have enough time to put in calls for delays and do all my other functions at the same time.

not delay(). yield() it prevents watchdog reset