ePIPE exception received when other end can't send an RST - how come?



Hello there
I am experimenting with a simple python script which establishes a TCP connection, over GPRS, to a server. It then periodically sends a small block of data (60 bytes or so) to the server.

I then disconnect the GPRS antenna on this client machine (I am actually investigating the behaviour of an independant bit of C++ code; the python is really being used as a test bench).

What I then see is that the number of bytes in the socket's output buffer builds up, and I then get a ePIPE exception (~SIGPIPE signal) in my script.

Now my copy of Richard Steven's 'Unix Network programming' says:

‘when a process writes to a socket that has received an RST, the SIGPIPE signal is sent to the process’

My python code is very simple: something like:

# setup

gSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
gSock.connect((IP_ADDR, IP_PORT))

p = MyPacket()
while 1:
except socket.error, e:
# display exception
except IOError, e
# ePIPE exception encountered here - but why?



I am trying to understand how the ePIPE exception can occur, given my scenario, and whether it is due to my using Python, or might also be applicable to my C++ code. Surely, if I have disconnected the antenna, the server willhave had no opportunity to send an RST? Is there another mechanism that might be causing the ePIPE?

I'm running Python 2.7.4 under x86 Kubuntu Linux, and python 2.4 on an embedded ARM Linux.

Thanks for any thoughts.



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question