473,289 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Socket communication problem

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

Oct 24 '07 #1
1 1432
Sandy Dunlop wrote:
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.

I forgot to add, I'm using Python 2.5.1 on OS X, and have also tried my
program under Python 2.5.1 on Solaris 9.
Cheers,
Sandy

Oct 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lindstrom Greg - glinds | last post by:
Hello- I have a python routine (Python 2.2.3 on Windows 2000 "Professional") using a socket connection. Problem is, the backend service I'm connecting to will hang every so often and the socket...
4
by: faktujaa | last post by:
Hi, I am having some problem with callback used in socket implementation. private static void Connect(string strPrtrIPAddr, int intPrtrPort, ref Socket rsocClient) { try { // Create remote end...
2
by: tantiboh | last post by:
I'm not a new programmer, but this one's got me stymied; hopefully it's a fairly trivial problem. I'm using a socket connection to receive communication from a server. Normally, the entire message...
3
by: Ricardo Quintanilla | last post by:
i had a problem whom i do not know how to explain. i was using a TcpClient (System.Net.Sockets.TcpClient) object to send and receive data to an AS400 socket. Two months ago it started to work...
4
by: Sa¹o Zagoranski | last post by:
Hi! I'm writing a simple 3D First person shooter game. It is a multiplayer game, where all the players connect to one server.
13
by: coloradowebdev | last post by:
i am working on basically a proxy server that handles requests via remoting from clients and executes transactions against a third-party server via TCP. the remoting site works like a champ. my...
1
by: Mr. Beck | last post by:
Hello, Please Help..... I have been working with some tcp/ip socket communication within a C# program recently. Basicly, I have a program (myProblemProgram) that has a socket connected to...
8
by: panko | last post by:
Hello, I can't manage with asynchronous socket communication. :( I wrote a class CSocket.cs. This class is taking care of sending strings to LED display. This display is actually communicating...
0
by: =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post by:
Hello, First of all I wish you a good day. My help request is about .NET asynchrounus socket communication. I have developed Server-Client Windows Forms .NET applications in VC++ .NET v2003. I...
0
by: Mangabasi | last post by:
Howdy, I would like to use the Synthesis Toolkit for a demo. I downloaded the STK from http://ccrma.stanford.edu/software/stk/index.html. It seems very powerful and user friendly. There are...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.