Differences between version 2 and predecessor to the previous major change of EINPROGRESS.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Friday, April 2, 2004 9:03:48 pm | by ScottLamb | Revert |
Older page: | version 1 | Last edited on Tuesday, February 18, 2003 11:52:06 pm | by PerryLorier | Revert |
@@ -1,6 +1,6 @@
!!!Operation in progress
Some operations take a long time to execute, mostly because they involve talking to another host, which may have an exruciating long timeout on it. If you don't want to block you UI while performing this operation you can either use threads, or non blocking sockets.
-For instance, when doing a connect(2) on a nonblocking socket, it will immediately return [EINPROGRESS] to let you know that the operation is in progress, and when select(2) (or related interface) says that the socket is ready for reading
, you can call connect
(2
) on it __again__ and have it
return as it normally
would if you
had called
it in a blocking manner.
+For instance, when doing a connect(2) on a nonblocking socket, it will immediately return [EINPROGRESS] to let you know that the operation is in progress, and when select(2) (or related interface) says that the socket is ready for writing
, you can call getsockopt
(fd, SOL_SOCKET, SO_ERROR, ...
) on it. getsockopt(2) will
return with the error connect(2)
would have indicated,
had it been called
in a blocking manner. If the error is , the connect succeeded
.
neat.