Changeset 57955 in vbox
- Timestamp:
- Sep 29, 2015 10:26:31 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 102934
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r57835 r57955 1851 1851 # define RTTraceGetDefaultBuf RT_MANGLER(RTTraceGetDefaultBuf) 1852 1852 # define RTTraceSetDefaultBuf RT_MANGLER(RTTraceSetDefaultBuf) 1853 # define RTUdpCreateClientSocket RT_MANGLER(RTUdpCreateClientSocket) 1853 1854 # define RTUdpRead RT_MANGLER(RTUdpRead) 1854 1855 # define RTUdpServerCreate RT_MANGLER(RTUdpServerCreate) -
trunk/include/iprt/udp.h
r57944 r57955 150 150 size_t cbBuffer, PCRTNETADDR pDstAddr); 151 151 152 /** 153 * Create and connect a data socket. 154 * 155 * @returns iprt status code. 156 * @param pszAddress The address to connect to. 157 * @param uPort The port to connect to. 158 * @param pSock Where to store the handle to the established connection. 159 */ 160 RTR3DECL(int) RTUdpCreateClientSocket(const char *pszAddress, uint32_t uPort, PRTSOCKET pSock); 161 152 162 /** @} */ 153 163 RT_C_DECLS_END -
trunk/src/VBox/Runtime/r3/udp.cpp
r57944 r57955 687 687 } 688 688 689 690 RTR3DECL(int) RTUdpCreateClientSocket(const char *pszAddress, uint32_t uPort, PRTSOCKET pSock) 691 { 692 /* 693 * Validate input. 694 */ 695 AssertReturn(uPort > 0, VERR_INVALID_PARAMETER); 696 AssertPtrReturn(pszAddress, VERR_INVALID_POINTER); 697 698 /* 699 * Resolve the address. 700 */ 701 RTNETADDR Addr; 702 int rc = RTSocketParseInetAddress(pszAddress, uPort, &Addr); 703 if (RT_FAILURE(rc)) 704 return rc; 705 706 /* 707 * Create the socket and connect. 708 */ 709 RTSOCKET Sock; 710 rc = rtSocketCreate(&Sock, AF_INET, SOCK_DGRAM, 0); 711 if (RT_SUCCESS(rc)) 712 { 713 RTSocketSetInheritance(Sock, false /* fInheritable */); 714 rc = rtSocketBind(Sock, &Addr); 715 if (RT_SUCCESS(rc)) 716 { 717 *pSock = Sock; 718 return VINF_SUCCESS; 719 } 720 RTSocketClose(Sock); 721 } 722 return rc; 723 }
Note:
See TracChangeset
for help on using the changeset viewer.