Connecting multiple clients to Arduino TCP/IP server

Hello,

I am looking for some advice on how to access a TCP/IP server on the Arduino using multiple clients.

I am using an Arduino UNO with Wifi Shield to connect to a local wireless network. I am able to get the Arduino to set up a server which I can then connect to using a telnet. I also programmed a LabVIEW VI to create a TCP/IP Client and connect to my Arduino server. The Client can read data sent from the server and send commands back (currently just a stop test command).

The issue I am running into is when I try to connect multiple clients to my server. If, for example, I have the LabVIEW VI connected and displaying the data it was sent, I cannot make a connection from a telnet app I have on my smartphone. Although the telnet can see the network, it does not connect; it simply indicates that it’s connecting until it times out. On occasion, when I’ve tried to make a second connection, the original connection crashed.

Being open to multiple client connections is important for my application. I am wondering if the issue is that the Arduino stops looking for connections once it’s made the one but I am not sure if this is the problem or, if it is, how to fix it. I’ve not been able to find any relevant threads on the subject although it seems like an important topic. I am hoping that the community can give me some direction.

Hoping to hear from you,
Yusif Nurizade

Single_Letter_Disconnect_9_10c_2014.ino (4.8 KB)

The standard ethernet library services only one client at a time. It won't take another connection until you close the previous connection. There are ways around that, but it is not as simple as using the library server routines.

The standard ethernet library services only one client at a time. It won't take another connection until you close the previous connection.

But, OP is using a WiFi shield...

The arduino wifi shield apparently doesn’t provide for more than single socket operation at a time.

https://www.google.com/search?as_q=wifi+socket&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=&gws_rd=ssl

OH! My bad. The wifi shield is a different story. It will handle more than one client at a time, just not correctly. The files requested may not be the files returned, or corrupted files are returned. It uses only one socket for the server, and never stops listening. If the wifi shield gets a second request before the previous request is complete, they could get each other’s files because they are using the same socket.

Here is the report I filed on 3 December 2013. No action taken yet.

Thanks for the responses guys, I appreciate your input.

zoomkat - I'm sorry but the link you provided goes to a search page, could you specify what you were directing me to?

SurferTim - Do you have the code for setting up multiple clients? Do I have to set up multiple sockets or can multiple clients just access one server? I don't have as much experience with TCP/IP connections with Arduino and I could use some guidance. The alternative is having the server on the computer but I'd rather anticipate a situation where I don't use the computer at all.

Thanks again, Yusif Nurizade

zoomkat - I'm sorry but the link you provided goes to a search page, could you specify what you were directing me to?

I'm directing you to previous forum post concerning wifi questions. you may find useful info there that might help you with your project now and in the future.

zoomkat,

Understood; I will look through the posts that come up in the search.

Thanks again, Yusif Nurizade