| View previous topic :: View next topic |
| Author |
Message |
Ikopar
Joined: 26 May 2006 Posts: 168
|
How do i know when a connection closes on a socket?
How do i recv until it closes? |
| |
|
|
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| send or recv will return 0 |
| |
|
|
Ikopar
Joined: 26 May 2006 Posts: 168
|
| Can i have an example, Poolkop ? |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
| |
Ikopar
Joined: 26 May 2006 Posts: 168
|
While s.recv(1) != 0:
?
That doesnt have such a nexample |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
Ikopar, it doesn't have anything to cut and paste, no. like i said, test for zero
And yes it does have an example. look for "mysend" and "myreceive". you can pull out that logic without needing a class wrapped around it like the example has
It's very old code but the socket api hasn't changed |
| |
|
|
Ikopar
Joined: 26 May 2006 Posts: 168
|
| Nvm, thanks |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| If you really need closed events, use twisted |
| |
|
|
Ikopar
Joined: 26 May 2006 Posts: 168
|
| It worked. thanks |
| |
|
|
|