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

Method connect

engine/source/platform/platformNet.cpp:1441–1476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1439}
1440
1441Net::Error Net::connect(NetSocket handleFd, const NetAddress *address)
1442{
1443 if(!(address->type == NetAddress::IPAddress || address->type == NetAddress::IPV6Address))
1444 return WrongProtocolType;
1445
1446 SOCKET socketFd = PlatformNetState::smReservedSocketList.resolve(handleFd);
1447
1448 if (address->type == NetAddress::IPAddress)
1449 {
1450 sockaddr_in socketAddress;
1451 NetAddressToIPSocket(address, &socketAddress);
1452
1453 if (socketFd == InvalidSocketHandle)
1454 {
1455 socketFd = PlatformNetState::smReservedSocketList.activate(handleFd, AF_INET, false);
1456 }
1457
1458 if (!::connect(socketFd, (struct sockaddr *) &socketAddress, sizeof(socketAddress)))
1459 return NoError;
1460 }
1461 else if (address->type == NetAddress::IPV6Address)
1462 {
1463 sockaddr_in6 socketAddress;
1464 NetAddressToIPSocket6(address, &socketAddress);
1465
1466 if (socketFd == InvalidSocketHandle)
1467 {
1468 socketFd = PlatformNetState::smReservedSocketList.activate(handleFd, AF_INET6, false);
1469 }
1470
1471 if (!::connect(socketFd, (struct sockaddr *) &socketAddress, sizeof(socketAddress)))
1472 return NoError;
1473 }
1474
1475 return PlatformNetState::getLastError();
1476}
1477
1478Net::Error Net::listen(NetSocket handleFd, S32 backlog)
1479{

Callers

nothing calls this directly

Calls 5

getLastErrorFunction · 0.85
resolveMethod · 0.80
NetAddressToIPSocketFunction · 0.70
NetAddressToIPSocket6Function · 0.70
activateMethod · 0.45

Tested by

no test coverage detected