[Edu-sig] writing an chat-server

Ka-Ping Yee ping@lfw.org
Wed, 12 Apr 2000 01:49:30 -0700 (PDT)


On Tue, 11 Apr 2000, A[r]TA wrote:
> error: (10054, 'winsock error')
> 
> I don't get it.. ;(
> What to do?
> Anyone suggestions??? Or am I doing something wrong??

This looks like a problem with Windows sockets.  I know
the program works perfectly on Unix -- i tested it.

Does it work if you implement the readline() routine
without makefile()?  That is, add this:

    def readline(sock):
        line = ""
        while 1:
            ch = sock.recv(1)
            line = line + ch
            if ch == "\n" or not ch: return line

and replace this:
    
    text = sock.makefile().readline()

with this:

    text = readline(sock)


-- ?!ng

"Je n'aime pas les stupides garçons, même quand ils sont intelligents."
    -- Roople Unia