jung6717 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Support network protocols that require server to send data before client e.g. VNC #186

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What change would you like to see?

Add a '.connected()' method to 'Server' which returns connected clients without 
consideration for 
whether they have data available (which '.available()' does).

Why?

At present it is not possible to implement a network protocol which requires 
the server to send 
data when the client connects but before the client sends data. VNC is an 
example of such a 
protocol. As is a telnet server which wished to send a banner on connection.

Would this cause any incompatibilities with previous versions?  If so, how
can these be mitigated?

Adding this method with the attached patch shouldn't cause incompatibilities 
unless someone 
has extended the Server class with a 'connected()' method themselves.

The implementation of the supplied patch is not ideal however as it simply 
duplicates most of the 
code in 'available()'. Ideally one method should call the other with some flag 
that indicates a 
check should be made for data available. Changing the implementation of 
'available()' in this 
manner would increase the possibility of accidental incompatibilities but 
should lead to a "more 
maintainable" implementation.

Original issue reported on code.google.com by follower@gmail.com on 15 Jan 2010 at 2:09

Attachments:

GoogleCodeExporter commented 8 years ago
I hadn't spotted this before (and haven't done enough with the Server class to 
have realised it was the case).  Going to post to the developers list about 
this and issue #616 to see if we can come up with a workable solution for both.

Original comment by adrian.m...@gmail.com on 31 Aug 2011 at 9:25