P1394 Mail Archive: P1394> recv() in non-blocking mode

P1394> recv() in non-blocking mode

Brian Batchelder (brianb@vcd.hp.com)
Wed, 09 Jun 1999 07:46:12 -0700

Someone asked what happens in non-blocking mode if you call recv() and no data has been received.

(BTW, non-blocking mode is a mode that you place a socket in by calling WSAASyncSelect() or ioctlsocket())

When recv() is called and there is no data, normally the call would block until data was received. In non-blocking mode, a call that normally would block returns a value of SOCKET_ERROR, and the specific error code "WSAEWOULDBLOCK" may be retrieved by calling WSAGetLastError(). recv() follows this rule. While it is not recommended, a crude polling technique could be implemented in this manner.

Brian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brian Batchelder | Hewlett-Packard | brianb@vcd.hp.com
Connectivity Standards Architect | 1115 SE 164th Ave. | Phone: (360) 212-4107
DeskJet Printers | Vancouver, WA 98684 | Fax: (360) 212-4227
IEEE 1212r Chair, IEEE 1284.4 Editor, 1394 Printer Working Group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~