MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / connect

Method connect

Engine/source/platform/platformNet.cpp:1469–1504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1467}
1468
1469Net::Error Net::connect(NetSocket handleFd, const NetAddress *address)
1470{
1471 if(!(address->type == NetAddress::IPAddress || address->type == NetAddress::IPV6Address))
1472 return WrongProtocolType;
1473
1474 SOCKET socketFd = PlatformNetState::smReservedSocketList.resolve(handleFd);
1475
1476 if (address->type == NetAddress::IPAddress)
1477 {
1478 sockaddr_in socketAddress;
1479 NetAddressToIPSocket(address, &socketAddress);
1480
1481 if (socketFd == InvalidSocketHandle)
1482 {
1483 socketFd = PlatformNetState::smReservedSocketList.activate(handleFd, AF_INET, false);
1484 }
1485
1486 if (!::connect(socketFd, (struct sockaddr *) &socketAddress, sizeof(socketAddress)))
1487 return NoError;
1488 }
1489 else if (address->type == NetAddress::IPV6Address)
1490 {
1491 sockaddr_in6 socketAddress;
1492 NetAddressToIPSocket6(address, &socketAddress);
1493
1494 if (socketFd == InvalidSocketHandle)
1495 {
1496 socketFd = PlatformNetState::smReservedSocketList.activate(handleFd, AF_INET6, false);
1497 }
1498
1499 if (!::connect(socketFd, (struct sockaddr *) &socketAddress, sizeof(socketAddress)))
1500 return NoError;
1501 }
1502
1503 return PlatformNetState::getLastError();
1504}
1505
1506Net::Error Net::listen(NetSocket handleFd, S32 backlog)
1507{

Callers

nothing calls this directly

Calls 6

NetAddressToIPSocketFunction · 0.85
NetAddressToIPSocket6Function · 0.85
getLastErrorFunction · 0.70
connectFunction · 0.50
resolveMethod · 0.45
activateMethod · 0.45

Tested by

no test coverage detected