Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DarkNET: Queue of some type when using TCP?

Author
Message
jeffhuys
17
Years of Service
User Offline
Joined: 24th May 2006
Location: No cheesy line here.
Posted: 1st Aug 2009 17:03
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:



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!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 1st Aug 2009 21:00 Edited at: 1st Aug 2009 21:06
When TCP packets are received they are put into a queue and received using mnRecvTCP. The packet will not be received instantly as it takes some time for the data to be transfered (when the server and client are on the same computer this time is only a few milliseconds).

You should use the timer function to wait a set amount of time before disconnecting the client, without blocking the execution of your program.

Have a look at the following untested code:


jeffhuys
17
Years of Service
User Offline
Joined: 24th May 2006
Location: No cheesy line here.
Posted: 2nd Aug 2009 00:33
Alright, looks much better

Thanks!



You're the 'th to view this signature!

Login to post a reply

Server time is: 2024-05-07 11:32:12
Your offset time is: 2024-05-07 11:32:12