/**\r
Send data using a network connection.\r
\r
- The ::send routine queues data to the network for transmission.\r
+ The sendto routine queues data to the network for transmission.\r
+ This routine is typically used for SOCK_DGRAM sockets that are shared\r
+ between multiple machine where it is required to specify the target\r
+ system address when sending the data.\r
+\r
The\r
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html">POSIX</a>\r
documentation is available online.\r
\r
@param [in] tolen Length of remote system address structure\r
\r
- @return ::send returns the number of data bytes that were\r
+ @return This routine returns the number of data bytes that were\r
sent and -1 when an error occurs. In the case of\r
- an error, errno contains more details.\r
+ an error, ::errno contains more details.\r
\r
**/\r
ssize_t\r
socklen_t tolen\r
)\r
{\r
+ BOOLEAN bBlocking;\r
ssize_t LengthInBytes;\r
CONST UINT8 * pData;\r
struct __filedes * pDescriptor;\r
&pDescriptor,\r
&errno );\r
if ( NULL != pSocketProtocol ) {\r
+ //\r
+ // Determine if the operation is blocking\r
+ //\r
+ bBlocking = (BOOLEAN)( 0 == ( pDescriptor->Oflags & O_NONBLOCK ));\r
+\r
//\r
// Send the data using the socket\r
//\r
pData = buffer;\r
do {\r
errno = 0;\r
- Status = pSocketProtocol->pfnSend ( pSocketProtocol,\r
- flags,\r
- length,\r
- pData,\r
- (size_t *)&LengthInBytes,\r
- to,\r
- tolen,\r
- &errno );\r
+ Status = pSocketProtocol->pfnTransmit ( pSocketProtocol,\r
+ flags,\r
+ length,\r
+ pData,\r
+ (size_t *)&LengthInBytes,\r
+ to,\r
+ tolen,\r
+ &errno );\r
if ( EFI_ERROR ( Status ) && ( EFI_NOT_READY != Status )) {\r
LengthInBytes = -1;\r
break;\r
//\r
pData += LengthInBytes;\r
length -= LengthInBytes;\r
- // TODO: Add non-blocking check\r
- } while (( 0 != length ) && ( EFI_NOT_READY == Status ));\r
+ } while (( 0 != length ) && ( EFI_NOT_READY == Status ) && bBlocking );\r
}\r
\r
//\r