[cse491] A few notes on the echo servers

Tim Miller mille449 at gmail.com
Mon Sep 28 12:43:36 PDT 2009


For the non-blocking server, we are supposed to keep track of data
over multiple receives to keep track of the close connection signal,
but you specified that the function that handles all sending/receiving
should take only one argument (the socket) and return true or false.
So I don't see any room here to pass along connection specific data
over multiple calls to the handle_connection() function.

The two solutions I can think of are either 1. global variables (eww)
or 2. passing more information to the function.  Is there another way
to do this?

--Tim


On Sun, Sep 27, 2009 at 6:35 PM, C. Titus Brown <ctb at msu.edu> wrote:
> On Sun, Sep 27, 2009 at 09:51:51AM -0400, Joe Amenta wrote:
>> 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.
>
> Both good points.  Presumably someone using 'print' on their server side
> would be able to figure out the \n.\n problem... ;)
>
> --titus
>
> _______________________________________________
> cse491-fall-2009 mailing list
> cse491-fall-2009 at lists.idyll.org
> http://lists.idyll.org/listinfo/cse491-fall-2009
>



More information about the cse491-fall-2009 mailing list