redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers

Ask your IT question here

when a connection closes on a socket



 
Post new topic   Reply to topic    Programming Forums -> Python programming forum
View previous topic :: View next topic  
Author Message
Ikopar
Enthusiastic Coder


Joined: 26 May 2006
Posts: 168
How do i know when a connection closes on a socket?
How do i recv until it closes?

Reply with quote
 
Poolkop
Enthusiastic Coder


Joined: 01 Jun 2006
Posts: 123
send or recv will return 0
Reply with quote
 
Ikopar
Enthusiastic Coder


Joined: 26 May 2006
Posts: 168
Can i have an example, Poolkop ?
Reply with quote
 
Poolkop
Enthusiastic Coder


Joined: 01 Jun 2006
Posts: 123
Ikopar, http://www.amk.ca/python/howto/sockets/
Reply with quote
 
Ikopar
Enthusiastic Coder


Joined: 26 May 2006
Posts: 168
While s.recv(1) != 0:
?
That doesnt have such a nexample

Reply with quote
 
Poolkop
Enthusiastic Coder


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

Reply with quote
 
Ikopar
Enthusiastic Coder


Joined: 26 May 2006
Posts: 168
Nvm, thanks
Reply with quote
 
Poolkop
Enthusiastic Coder


Joined: 01 Jun 2006
Posts: 123
If you really need closed events, use twisted
Reply with quote
 
Ikopar
Enthusiastic Coder


Joined: 26 May 2006
Posts: 168
It worked. thanks
Reply with quote
 
Page 1 of 1
Post new topic   Reply to topic    Programming Forums -> Python programming forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group