My TCP Server is written in Qt 4.7, works well with TCP Client also written in Qt 4.7.
I am trying to connect and communicate with Server with client written in python 2.7.3. I start the Server process via apache http request with subprocess.call(path_to_server)
. I am using mod_wsgi 3.3 and django 1.4.
Connection is established without a problem. I am receiving [Errno 32] Broken pipe
exception on socket.send()
randomly (I can spam same msg for 10 times and it will be sent 0-10 times). Same happens to socket.shutdown()
& socket.close()
, I can spam disconnect command and it will randomly disconnect, otherwise receiving [Errno 107] Transport endpoint is not connected
exception.
netstat -nap says connection is established.
When I try running same client script using python2.7 shell everything works fine.
What am I missing here?
EDIT
Everything works on Windows 7, running same apache,mod_wsgi,python,django configuration. TCP Server is also Windows compatible. Error happens on centos6.2 32bit.
I had to set apache settings to following:
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 5
I will further investigate the problem and see if this is proper solution.