[Python-bugs-list] [ python-Bugs-419873 ] ThreadingTCPServer invalidating sockets
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 28 Apr 2001 16:22:56 -0700
Bugs item #419873, was updated on 2001-04-28 16:22
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=419873&group_id=5470
Category: Threads
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: ThreadingTCPServer invalidating sockets
Initial Comment:
running this:
import SocketServer
class TestServer(SocketServer.ThreadingTCPServer):
def __init__(self, server_address,
RequestHandlerClass):
SocketServer.ThreadingTCPServer.__init__(self,
server_address, RequestHandlerClass)
self.quit = 0
def process_request(self, request, client_address):
print 'socket in process_request = %s' % request
print 'id(socket) in process_request = %d' %
id(request)
SocketServer.ThreadingTCPServer.process_request(self,
request, client_address)
def finish_request(self, request, client_address):
print 'socket in finish_request = %s' % request
print 'id(socket) in finish_request = %d' %
id(request)
self.RequestHandlerClass(request,
client_address, self)
def get_request(self):
conn, addr = self.socket.accept()
print 'socket in get_request = %s' % conn
print 'id(socket) in get_request = %d' % id(conn)
return conn,addr
if __name__ == '__main__':
s = TestServer(('',9950),
SocketServer.BaseRequestHandler)
s.handle_request()
s.server_close()
results in the following output (when connected to
remotely):
socket in get_request = <socket object, fd=4, family=2,
type=1, protocol=0>
id(socket) in get_request = 135335216
socket in process_request = <socket object, fd=4,
family=2, type=1, protocol=0>
id(socket) in process_request = 135335216
socket in finish_request = <socket object, fd=-1,
family=2, type=1, protocol=0>
id(socket) in finish_request = 135335216
between in the thread-creation in process_request, the
socket's fd changes to -1.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=419873&group_id=5470