AndrewTK wrote:
> > I'm assuming that your server waits to receive the word 'hello' before
> > replying with the three strings (first, second, and third)?  So once your
>
> Nope - actually it's a threaded "server", with the main thread simply
> dumping network input to the console and command line input being
> directly dumped to the network output stream.
>
> I confess to having typed the three lines manually...!
>
> It's at:
> http://www.dcs.st-and.ac.uk/~atk1/perso/java/servers/RespondingServer.java
>
> It launches on the command line with
> java RespondingServer _port_
>
> _port_ being the port number it should listen for data on.

Hooooy.  I tried reading your Java code..  What can I say?  There's a
reason why I like Python...  :-)

I couldn't see anything obviously broken in your server, but there's
definitely nothing wrong with your python code, except that you call
flush() on the socket (fixed in your posted code but not in the linked
code.)

Here are the results of testing, with netcat substituted for your java
server:

# on the server side:
[EMAIL PROTECTED]:~ $ netcat -p 54321 -l
hellohi there
how are you
I'm fine thanks

[EMAIL PROTECTED]:~ $



# on the client side:
[EMAIL PROTECTED]:~ $ python delme.py
'hi there\n'
'how are you\n'
"I'm fine thanks\n"
[EMAIL PROTECTED]:~ $


So I'm guessing it's something wrong in your java server.

HTH,
~Simon

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to