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

J

jkn

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:
try:
gSock.send(p)
except socket.error, e:
# display exception
except IOError, e
# ePIPE exception encountered here - but why?

time.sleep(15)

}}}

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.

J^n
 

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

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top