Socket Programming HOWTO example

Bryan Olson fakeaddress at nowhere.org
Tue Jan 17 13:32:43 EST 2006


I mis-phrased:
> The code passes
> 'self' to __init__, but not to any of the others methods.

Of course I meant that the formal parameter for self is missing.

>  > class mysocket:
> 
>>         '''classe solamente dimostrativa
>>           - codificata per chiarezza, non per efficenza'''
>>         def __init__(self, sock=None):
>>             if sock is None:
>>                 self.sock = socket.socket(
>>                     socket.AF_INET, socket.SOCK_STREAM)
>>             else:
>>                 self.sock = sock
>>         def connect(host, port):
>>             self.sock.connect((host, port))
>>         def mysend(msg):
[...]



More information about the Python-list mailing list