S
Sandy Dunlop
Hi,
I'm new here, and fairly new to Python. I have been playing around with
Python and started having a look at socket IO. I have written a script
that communicates over a network to a server which is written in C.
While trying to get this working, I have been running into a problem
where the Python client appears to hang when it should be receiving data
back from the server.
After a few successful exchanges of data, the server sends 3605 bytes to
the client, which the client receives. The server then sends 2 bytes to
the client, and the client doesn't get them. A client program written in
C# does not have this problem.
I have narrowed the problem down as far as I can, and have two small
scripts, client and server, and a data file they read from to know what
they should be sending and receiving. The problem can be replicated
using them within a few milliseconds of running them.
At first, I thought this may be caused by Nagel's algorithm, so I
disabled it explicitly using:
s.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
This made no difference.
Can anyone point out what I'm doing wrong here?
You can get the scripts and the 7K data file here:
http://www.sorn.net/~sandyd/python/problem/
Or all together in a zip file here:
http://www.sorn.net/~sandyd/python/problem.zip
Thanks in advance,
Sandy
I'm new here, and fairly new to Python. I have been playing around with
Python and started having a look at socket IO. I have written a script
that communicates over a network to a server which is written in C.
While trying to get this working, I have been running into a problem
where the Python client appears to hang when it should be receiving data
back from the server.
After a few successful exchanges of data, the server sends 3605 bytes to
the client, which the client receives. The server then sends 2 bytes to
the client, and the client doesn't get them. A client program written in
C# does not have this problem.
I have narrowed the problem down as far as I can, and have two small
scripts, client and server, and a data file they read from to know what
they should be sending and receiving. The problem can be replicated
using them within a few milliseconds of running them.
At first, I thought this may be caused by Nagel's algorithm, so I
disabled it explicitly using:
s.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
This made no difference.
Can anyone point out what I'm doing wrong here?
You can get the scripts and the 7K data file here:
http://www.sorn.net/~sandyd/python/problem/
Or all together in a zip file here:
http://www.sorn.net/~sandyd/python/problem.zip
Thanks in advance,
Sandy