MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SendTCP

Method SendTCP

pcsx2/DEV9/sockets.cpp:438–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438bool SocketAdapter::SendTCP(ConnectionKey Key, IP_Packet* ipPkt)
439{
440 IP_PayloadPtr* ipPayload = static_cast<IP_PayloadPtr*>(ipPkt->GetPayload());
441 TCP_Packet tcp(ipPayload->data, ipPayload->GetLength());
442
443 Key.ps2Port = tcp.sourcePort;
444 Key.srvPort = tcp.destinationPort;
445
446 const int res = SendFromConnection(Key, ipPkt);
447 if (res == 1)
448 return true;
449 else if (res == 0)
450 return false;
451 else
452 {
453 Console.WriteLn("DEV9: Socket: Creating New TCP Connection to %d", tcp.destinationPort);
454 TCP_Session* s = new TCP_Session(Key, adapterIP);
455
456 s->AddConnectionClosedHandler([&](BaseSession* session) { HandleConnectionClosed(session); });
457 s->destIP = ipPkt->destinationIP;
458 s->sourceIP = dhcpServer.ps2IP;
459 connections.Add(Key, s);
460 return s->Send(ipPkt->GetPayload());
461 }
462}
463
464bool SocketAdapter::SendUDP(ConnectionKey Key, IP_Packet* ipPkt)
465{

Callers

nothing calls this directly

Calls 6

GetPayloadMethod · 0.45
GetLengthMethod · 0.45
WriteLnMethod · 0.45
AddMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected