Code:
ushort SessionId = BitConverter.ToUInt16(new byte[2] { RecvPacket[4], RecvPacket[5] },0);
byte[] RemotePort = new Byte[2];
RemotePort = BitConverter.GetBytes(IPeo.Port);
byte[] RemoteIp = new Byte[4];
RemoteIp = BitConverter.GetBytes(IPeo.Address.Address); //decimal address
byte[] LocalPort = new Byte[2];
LocalPort[0] = (byte)(RecvPacket[32] ^ 0x45);
LocalPort[1] = (byte)(RecvPacket[33] ^ 0x45);
byte[] LocalIp = new Byte[4];
LocalIp[0] = (byte)(RecvPacket[37] ^ 0x45);
LocalIp[1] = (byte)(RecvPacket[36] ^ 0x45);
LocalIp[2] = (byte)(RecvPacket[35] ^ 0x45);
LocalIp[3] = (byte)(RecvPacket[34] ^ 0x45);
int myLocPort = BitConverter.ToInt32(new byte[2] { LocalPort[1], LocalPort[0] },0);
Response = new Byte[65]
{
0x10, 0x10, 0x00, 0x00,
RecvPacket[4], RecvPacket[5],
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x41,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x13, 0x11,
RemotePort[1], RemotePort[0],
RemoteIp[3], RemoteIp[2], RemoteIp[1], RemoteIp[0],
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x01, 0x11, 0x13, 0x11,
LocalPort[1], LocalPort[0],
LocalIp[3], LocalIp[2], LocalIp[1], LocalIp[0],
0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x11
};
foreach (cWRClient _Client in cMain.WRServer.getPlayers(false))
{
if (_Client.getSessionID() == SessionId)
{
_Client.setLocalNetwork(BitConverter.ToInt32(LocalIp,0), myLocPort); // Set UDP EndPoint @Client, because it needs this Information(Network IP, Network Port, Local IP, Local Port)
_Client.RealSessionID = SessionId;
break;
}
}
Ja bin schon weiter gekommen in Sachen UDP Packets naja, bin erstmal 10 tage in Frankreich(austausch)