Send packets to a server using SCAR on an already open connection?
The problem I have here is that when I create a new connection and send a packet to a server it gets ignored as it is sending it using the new connection and not the existing one.
I made a small function here:
SCAR Code:
Function SendPacket: Boolean;
Var
Packet:Integer;
Begin
Packet := OpenConnection('', , 5000); //I edited out the I.P and Port
If Packet = -1 Then Exit;
Writeln('Packet ID: '+IntToStr(Packet));
Wait(500);
If IsConnectionOpen(Packet) Then
Begin
Writeln('Connection Open! Attempting to send packet ...');
If SendConnectionData(Packet, '00 00 00 00 00 ') Then //Edited packet
Begin
Result := True;
Wait(1000);
Writeln('Packet Sent!');
End Else Writeln('Sending failed');
End;
End;
Now what happens is when I run this function it does create a new connection and I do get the "Packet Sent!" in the debug ... but nothing happens.
I was just wondering if there is a way to see if there is a socket already open on a specific I.P and PORT and if I am able to send packets using that, because as I stated before it does not work correctly if I create a new packet.