]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/BsdSocketLib/send.c
UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiCr3" with PatchInstructionX86()
[mirror_edk2.git] / StdLib / BsdSocketLib / send.c
index e0ec64367c6b561b61d52df2eaa851582bf7b879..439d8081c199c220819b84dd462a6c5cf62d76cf 100644 (file)
 /**\r
   Send data using a network connection.\r
 \r
-  The ::send routine queues data to the network for transmission.\r
+  The send routine queues data to the network for transmission.\r
+  This routine is typically used for SOCK_STREAM sockets where the target\r
+  system was specified in the ::connect call.\r
+\r
   The\r
   <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html">POSIX</a>\r
   documentation is available online.\r
   @param [in] s         Socket file descriptor returned from ::socket.\r
 \r
   @param [in] buffer    Address of a buffer containing the data to send.\r
-    \r
+\r
   @param [in] length    Length of the buffer in bytes.\r
 \r
   @param [in] flags     Message control flags\r
 \r
-  @returns    ::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
@@ -44,54 +47,8 @@ send (
   int flags\r
   )\r
 {\r
-  ssize_t LengthInBytes;\r
-  CONST UINT8 * pData;\r
-  struct __filedes * pDescriptor;\r
-  EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
-  EFI_STATUS Status;\r
-\r
-  //\r
-  //  Assume failure\r
-  //\r
-  LengthInBytes = -1;\r
-\r
-  //\r
-  //  Locate the context for this socket\r
-  //\r
-  pSocketProtocol = BslFdToSocketProtocol ( s,\r
-                                            &pDescriptor,\r
-                                            &errno );\r
-  if ( NULL != pSocketProtocol ) {\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
-                                          NULL,\r
-                                          0,\r
-                                          &errno );\r
-      if ( EFI_ERROR ( Status )) {\r
-        LengthInBytes = -1;\r
-        break;\r
-      }\r
-\r
-      //\r
-      //  Account for the data sent\r
-      //\r
-      pData += LengthInBytes;\r
-      length -= LengthInBytes;\r
-      // TODO: Add non-blocking check\r
-    } while (( 0 != length ) && ( EFI_NOT_READY == Status ));\r
-  }\r
-\r
   //\r
-  //  Return the number of data bytes sent, -1 for errors\r
+  //  Send the data\r
   //\r
-  return (INT32)LengthInBytes;\r
+  return sendto ( s, buffer, length, flags, NULL, 0 );\r
 }\r