How to deal with blocking calls in socket programming? fernando 26-October-2007 05:20:47 PMComments www.developerfusion.com/.../socket-programming-in-c-part-1 Posted by crouse www.amk.ca/python/howto/sockets Posted by crouse We can fix arguments, too, which is how you deal with loop control in Erlang. ? END_CHAR is 127, so if we call loop(Socket, 127) it first ... Posted by waqasahmad * Many of the functions we saw block until a certain event - accept: until a connection comes in - connect: until the connection is established - recv, recvfrom: until a packet (of data) is received - send, sendto: until data is pushed into socket’s buffer * Q: why not until received? * For simple programs, blocking is convenient * For complex programs - multiple connections - simultaneous sends and receives - simultaneously doing non-networking processing * Options: - use the select function call - create multi-process or multi-threaded code - turn off the blocking feature (e.g., using the fcntl file-descriptor control function) * Select - can be permanent blocking, time-limited blocking or non-blocking - input: a set of file-descriptors - output: info on the file-descriptors’ status -i.e., can identify sockets that are “ready for use”: calls involving that socket will return immediately Posted by jhon186 |
Posted: 26-October-2007 05:37:50 PM By: jhon186 * Many of the functions we saw block until a certain event - accept: until a connection comes in - connect: until the connection is established - recv, recvfrom: until a packet (of data) is received - send, sendto: until data is pushed into socket’s buffer * Q: why not until received? * For simple programs, blocking is convenient * For complex programs - multiple connections - simultaneous sends and receives - simultaneously doing non-networking processing * Options: - use the select function call - create multi-process or multi-threaded code - turn off the blocking feature (e.g., using the fcntl file-descriptor control function) * Select - can be permanent blocking, time-limited blocking or non-blocking - input: a set of file-descriptors - output: info on the file-descriptors’ status -i.e., can identify sockets that are “ready for use”: calls involving that socket will return immediately | |
Posted: 31-December-2008 12:08:48 AM By: waqasahmad We can fix arguments, too, which is how you deal with loop control in Erlang. ? END_CHAR is 127, so if we call loop(Socket, 127) it first ... | |
Posted: 18-September-2009 04:39:27 AM By: crouse www.amk.ca/python/howto/sockets | |
Posted: 18-September-2009 04:40:55 AM By: crouse www.developerfusion.com/.../socket-programming-in-c-part-1 |