[Python-de] SocketServer Problem

Felix Seeger felix.seeger at gmx.de
Wed May 1 16:26:35 EDT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Ich bin gerade dabei einen einfachen Server und einen einfachen Client zu 
bauen.

Ich bekomme aber immer diesen Fehler wenn ich eine Verbindung zum Server 
aufbaue:
The socket is listening to port 8888
- ----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 34698)
Traceback (most recent call last):
  File "/usr/lib/python2.2/SocketServer.py", line 221, in handle_request
    self.process_request(request, client_address)
  File "/usr/lib/python2.2/SocketServer.py", line 240, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.2/SocketServer.py", line 253, in finish_request
    self.RequestHandlerClass(request, client_address, self)
TypeError: __init__() takes exactly 3 arguments (4 given)
- ----------------------------------------

Hier der Server:
import SocketServer

port = 8888
class myRequestHandler(SocketServer.TCPServer):
	def handle(self):
		print "connection from ", self.client_address
		
drssocket = SocketServer.TCPServer(("", port), myRequestHandler)
print "The socket is listening to port", port
drssocket.serve_forever()

hier der Client:

import socket

drssocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
drssocket.connect( ("localhost", 8888) )
drssocket.sendall('test')
drssocket.close()
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8z+0MS0DOrvdnsewRAs8HAJ4ymI33s0+xke2GILQJ49v7ZG+4zQCcDyN3
7p+tpFHhSLjq2QniJwjf48o=
=MobH
-----END PGP SIGNATURE-----




More information about the Python-de mailing list