VirtualBox

Changeset 57970 in vbox


Ignore:
Timestamp:
Sep 30, 2015 2:56:34 PM (9 years ago)
Author:
vboxsync
Message:

Runtime: fixed parameters for RTUdpCreateClientSocket

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/udp.h

    r57957 r57970  
    156156 * @param   pszAddress          The address to connect to.
    157157 * @param   uPort               The port to connect to.
    158  * @param   pDefaultDstAddr     A default destination address for sending data
    159  *                              through this socket, can be NULL.
     158 * @param   pLocalAddr          The local address to bind this socket to, can be
     159 *                              NULL.
    160160 * @param   pSock               Where to store the handle to the established connection.
    161161 */
    162 RTR3DECL(int) RTUdpCreateClientSocket(const char *pszAddress, uint32_t uPort, PRTNETADDR pDefaultDstAddr, PRTSOCKET pSock);
     162RTR3DECL(int) RTUdpCreateClientSocket(const char *pszAddress, uint32_t uPort, PRTNETADDR pLocalAddr, PRTSOCKET pSock);
    163163
    164164/** @} */
  • trunk/src/VBox/Runtime/r3/udp.cpp

    r57958 r57970  
    688688
    689689
    690 RTR3DECL(int) RTUdpCreateClientSocket(const char *pszAddress, uint32_t uPort, PRTNETADDR pDefaultDstAddr, PRTSOCKET pSock)
     690RTR3DECL(int) RTUdpCreateClientSocket(const char *pszAddress, uint32_t uPort, PRTNETADDR pLocalAddr, PRTSOCKET pSock)
    691691{
    692692    /*
     
    695695    AssertReturn(uPort > 0, VERR_INVALID_PARAMETER);
    696696    AssertPtrReturn(pszAddress, VERR_INVALID_POINTER);
     697    AssertPtrReturn(pSock, VERR_INVALID_POINTER);
    697698
    698699    /*
     
    712713    {
    713714        RTSocketSetInheritance(Sock, false /* fInheritable */);
    714         rc = rtSocketBind(Sock, &Addr);
     715        if (pLocalAddr)
     716            rc = rtSocketBind(Sock, pLocalAddr);
    715717        if (RT_SUCCESS(rc))
    716718        {
    717             if (pDefaultDstAddr)
    718                 rc = rtSocketConnect(Sock, pDefaultDstAddr, RT_SOCKETCONNECT_DEFAULT_WAIT);
     719            rc = rtSocketConnect(Sock, &Addr, RT_SOCKETCONNECT_DEFAULT_WAIT);
    719720            if (RT_SUCCESS(rc))
    720721            {
  • trunk/src/VBox/Runtime/testcase/tstRTUdp-1.cpp

    r57957 r57970  
    3030#include <iprt/string.h>
    3131#include <iprt/test.h>
    32 
    33 #define RT_TEST_UDP_CLIENT_ADDRESS     "localhost"
    34 #define RT_TEST_UDP_CLIENT_PORT        52001
    3532
    3633/* Server address must be "localhost" */
     
    9996    int rc;
    10097    RTSOCKET hSocket;
    101     RTTESTI_CHECK_RC(rc = RTUdpCreateClientSocket(RT_TEST_UDP_CLIENT_ADDRESS, RT_TEST_UDP_CLIENT_PORT, &ServerAddress, &hSocket),
    102                      VINF_SUCCESS);
     98    RTTESTI_CHECK_RC(rc = RTUdpCreateClientSocket(RT_TEST_UDP_LOCAL_HOST, RT_TEST_UDP_SERVER_PORT, NULL, &hSocket), VINF_SUCCESS);
    10399    if (RT_SUCCESS(rc))
    104100    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette