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 server not sending packets

Author
Message
Interplanetary Funk
15
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 7th Aug 2010 12:41 Edited at: 7th Aug 2010 12:43
As the title suggests, the server I've written is not sending packets to its clients. The server seems to receive them fine, but it simply won't send them. I've tried both UDP and TCP modes but still neither send, I've tried running the server and clients on 3 different computers but it still doesn't send. Hopefully someone can aid me in this as I would really like to implement LAN and possibly online play into my game (through matchmaking rather than hosting). Anyway, here's my source, thanks in advance for any help.



EDIT: I have also tried sending fixed values directly to the client as well, and I get the same problem.
KISTech
17
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2010 01:37
First, when sending data like player data over UDP, it's best to use something other than a catch all mode. Per client Per operation is much better.

Next, you are sending packets to every client every loop. This is going to overwhelm the network, and nothing will get through, or at least very little. Only send what you have to, when you have to.

You don't have to clear the packets every time either. Once you have received or sent one, they are cleared automatically.

Also, if you read over the use of instance numbers, you'll see that you have to specify how many instances you want to set up, but they start at 0. So in this code you are using an instance number that doesn't exist.

Hope that helps a little.

Interplanetary Funk
15
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 8th Aug 2010 04:11
I've made the changes you mentioned and also went through the demo projects fairly in depth, and the good news is the server is now sending the packets! The bad, is now (even after sorting out my client code for use with the updated server) I am now getting a client side error (screenie attached) unfortunately, the error doesn't tell me much about what's really going wrong with my code. Here's the code for handling darknet at the client end:


And the updated server source:
KISTech
17
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2010 20:35
It's telling you that somewhere you've got the client ID wrong. Look at the variables you are storing the client ID in, or using a client ID in a command, and see if it could ever equal 0. That's probably what's going on somewhere in there.

Interplanetary Funk
15
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 8th Aug 2010 23:12
well this is the only part in the client that receives UDP packets:


and I can't see what's wrong there as its almost an exact copy as the one from the cube world client, except a few variable names have been changed.
KISTech
17
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Aug 2010 20:04
Quote: "
if _PLAYER <> mn get client id(1)
"


It seems to me, this line is telling it that if the packet is for THIS client, then don't check it.

Change it to this, and it should work. (theoretically)



If that player then isn't connected to the server, you shouldn't receive anything for them anyway. So there's no harm in checking for it.

Interplanetary Funk
15
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 9th Aug 2010 22:43
I've changed it to the code you suggested, but I'm still getting the exact same error.
Michael P
19
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 10th Aug 2010 19:05 Edited at: 10th Aug 2010 19:07
That error message is displayed when the client receives a packet from the server which is incorrectly formatted in per client or per client per operation UDP modes. So the packet sent from the server is wrong, see the docs for the correct packet layout.

Interplanetary Funk
15
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 12th Aug 2010 17:28
Sorry for the slow reply, I haven't had a chance to look at my code until today. I went over the documentation like you said and realise I forgot to add the client ID to the start of the send packet from my server. Thank you both for helping me sort this out.

Login to post a reply

Server time is: 2025-08-08 18:32:32
Your offset time is: 2025-08-08 18:32:32