[cse491] A few notes on the echo servers

C. Titus Brown ctb at msu.edu
Sat Sep 26 19:26:20 PDT 2009


Hi all,

a few notes on the echo servers (p2 and p3 in the homework).

First, a \n followed by a . followed by a \n should close both echo
servers, independently of when those characters arrive.  They may be
spread across multiple recv calls, in particular.  You can test this
effectively by changing your server to do 'sock.recv(1)' instead of
4096.

Second, very important point on the non-blocking server: sockets
returned by 'accept()' are "new" and do not inherit non-blocking status
from their parent bound sockets.  e.g. in the HW, 'client_sock' would be
set to blocking independently of the blocking status of 'sock'.

Third, the non-blocking echo server should accept connections at any
time, process as many connections as possible (> 2, in other words),
and discard closed socket connections from the list of connections to
process.

Fourth, 'telnet' simply connects to the specified host/port and sends
whatever text you type to that host/port.  It's a good way to test some
basic functionality because it doesn't require you to program a client
in order to test a server.

--titus
-- 
C. Titus Brown, ctb at msu.edu



More information about the cse491-fall-2009 mailing list