On Nov 27, 4:21 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 27 Nov 2007 07:08:04 -0800 (PST), [EMAIL PROTECTED] wrote: > >Hi all, > > >I have a problem with reading from a Java server after I have written > >to it - it just hangs. It works fine if I just write to the server and > >not try to write. I have read the HOWTO on sockets - and it states > >that there is a problem (something about flushing), but not what the > >solutions is. Nor do google. Can somebody please help? > > >A few lines down you can see the example code that sums up the > >problem. Just change the name of the Python HOST-variable. > > >Thanks > >Mads > > > [snip] > >s.send("Hi Java Server"); > > Here, you sent some bytes (maybe - you didn't check the return value of > send, so it's possible nothing at all was sent) but you didn't send a new > line indicator of any sort. > > > [snip] > > print(buf.readLine()); > > Here, you tried you read a line from the socket. The peer never sent a > whole line though, so readLine will never succeed. > > Jean-Paul
Thanks, sometimes the obvious causes the biggest problems ;) Thanks a lot! /Mads -- http://mail.python.org/mailman/listinfo/python-list