[cse491] A few notes on the echo servers

Joe Amenta amentajo at msu.edu
Sun Sep 27 06:51:51 PDT 2009


The telnet protocol states that telnet delimits lines with "\r\n", so just
by keyboard input, it would be very difficult if not impossible to send
"\n.\n" to make sure that ending condition is checked.
One way to get around this would be to replace all instances of "\r\n" with
"\n" on the server-side.  Another solution would be to use a program called
"netcat", which is like telnet but with a few important differences.  One
difference is that it sends "\n" at the end of lines.

Netcat is a UNIX utility, but there are ports for POSIX, Darwin, and
Windows.

--Joe

On Sat, Sep 26, 2009 at 10:26 PM, C. Titus Brown <ctb at msu.edu> wrote:

> 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
>
> _______________________________________________
> cse491-fall-2009 mailing list
> cse491-fall-2009 at lists.idyll.org
> http://lists.idyll.org/listinfo/cse491-fall-2009
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/cse491-fall-2009/attachments/20090927/eb5da21c/attachment.html 


More information about the cse491-fall-2009 mailing list