When my client connects to my server, it sends a TCP packet with information about the player model. If it did not receive a TCP packet, it kicks the client off (security).
When I use this code, the client will be kicked off
immediately:
` Check for new clients
Joined = mn Client Joined(0)
if Joined > 0
` Display client information
print "A new client has joined with a client ID of";
print Joined
print " Client TCP IP is: ";
print mn Get Client IP TCP(0, Joined)
print " Client TCP port is: ";
print mn Get Client Port TCP(0, Joined)
print " Client UDP IP is: ";
print mn Get Client IP UDP(0, Joined)
print " Client UDP port is: ";
print mn Get Client Port UDP(0, Joined)
TCPPacket = mn Recv TCP(0, RecvPacket, Joined)
print " Getting model... "
if TCPPacket > 0
if mn Get Int(RecvPacket) = OP_MODELPLAYER
Print "OP_MODELPLAYER"
Model = mn Get Int(RecvPacket)
Print "Model = ", Model, ", thus path ="
Select Model
Case MODEL_DWARF
Print "Media/Objects/Dwarf/Dwarf1.x"
Endcase
Endselect
Endif
Else
Print "ERROR: Got no TCP packet from client."
Print "Kicking client."
mn Add String SendPacket, "You have been kicked. Reason: No TCP packet received.", 0, 1
mn Send TCP 0, SendPacket, Joined, 0, 0
mn Disconnect Client 0, Joined
Endif
But when I add a "wait 100" command between
Quote: "print mn Get Client Port UDP(0, Joined)"
And
Quote: "TCPPacket = mn Recv TCP(0, RecvPacket, Joined)"
My server will recognize it fine and let the client connect further. But using this will eventually slow the server down if many people connect and disconnect and so.
Is there any workaround for this?
Thanks!
You're the
'th to view this signature!