Go Down

Topic: Disconnect client from Server/EthernetServer. (Read 469 times) previous topic - next topic

arduinian

From the docs http://arduino.cc/en/Reference/Ethernet, EthernetServer class doesn't seem to have a disconnect method for disconnecting connected clients. If there are more than 4 clients connected, EthernetServer would froze until one or two of the clients disconnect. This is a limitation of the shield:

Quote
The Arduino Ethernet Shield allows an Arduino board to connect to the internet. It is based on the Wiznet W5100 ethernet chip (datasheet). The Wiznet W5100 provides a network (IP) stack capable of both TCP and UDP. It supports up to four simultaneous socket connections. Use the Ethernet library to write sketches which connect to the internet using the shield. The ethernet shield connects to an Arduino board using long wire-wrap headers which extend through the shield. This keeps the pin layout intact and allows another shield to be stacked on top.
- http://arduino.cc/en/Main/ArduinoEthernetShield


Is there a way to disconnect clients from the EthernetServer once they're done doing their stuff?

SurferTim

#1
Jan 31, 2013, 12:44 pm Last Edit: Jan 31, 2013, 12:45 pm by SurferTim Reason: 1
You should be using the client functions after the server.available() call. Take a look at my server code.
http://playground.arduino.cc/Code/WebServerST

This gets the client.
Code: [Select]
EthernetClient client = server.available();

After that, use the client calls.
Code: [Select]
client.print();
client.println();
client.write();
//and when you are finished sending packets
client.stop();

edit: client.stop() is the "disconnect".

arduinian


Go Up