J
Jane Austine
Running Python 2.3 on Win XP
It seems like socket is working interdependently with subprocesses of
the process which created socket.
------------------------------------
#the server side
#the client sidehello world
------------------------------
Now when the client requests to recv 1024 bytes, and since there is no
more to read from the socket it blocks.
#client side
and the server side tries to close the socket:
#server side
Alas, the client side doesn't wake up! It doesn't wake up unless the
notepad is exited first; only after that, 'Connection reset by peer'
is raised. What does the socket has to do with subprocesses?
It seems like socket is working interdependently with subprocesses of
the process which created socket.
------------------------------------
#the server side
11import socket
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(('localhost',9000))
s.listen(5)
z=s.accept()
import os
f=os.popen('notepad.exe') #notepad appears on the screen
z[0]z[0].recv(6) 'foobar'
z[0].send('hello world')
#the client sidehello world
------------------------------
Now when the client requests to recv 1024 bytes, and since there is no
more to read from the socket it blocks.
#client side
and the server side tries to close the socket:
#server side
z[0].close()
#yes, it seems to have worked.
Alas, the client side doesn't wake up! It doesn't wake up unless the
notepad is exited first; only after that, 'Connection reset by peer'
is raised. What does the socket has to do with subprocesses?