read/write to java socket in python

madsornomads at gmail.com madsornomads at gmail.com
Tue Nov 27 13:32:07 EST 2007


On Nov 27, 4:29 pm, hdante <hda... at gmail.com> wrote:
> On Nov 27, 1:08 pm, madsornom... at gmail.com 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
>
> > This is the client in Python:
> > #! /usr/bin/env python
>
> > import sys
> > from socket import *
>
> [Snip - a little Python]
>
> > And this the server in Java:
> > import java.io.*;
> > import java.net.*;
>
> [Snip - a lot of Java]
>
> > }
>
>  I don't know, but it's amazing to compare the python client with the
> java server.


Yes, Python is really handy :)

/Mads



More information about the Python-list mailing list