1

I have asked a similar question to this before, but received limited help because of the lack of code I provided. I have written a client/server application as the prototype for a game my organization is developing. The issue I have is that the client after the initial connection is made, sends UDP data and receives the very first packet, but none of the rest. The client is initiating the "connection"(I know UDP is a connectionless protocol... you know what I mean). I have checked the packets sent and received through wireshark and they are being sent and received apparently correctly. The server is port forwarded so it receives all the data coming from the client. I am getting no errors, and the packets are all approximately the same size. I have posted my code here: http://pastebin.com/k5NsBDsQ so that you can look through it and see where a mistake might be. This is the complete code not just the parts I believe relevant. Thanks in advance for your help.

Stephen
  • 174
  • 4
  • 14
  • When multiple packets are to be sent in quick succession, have you tried setting a small delay between when each of them are to be sent? – Chris Laplante Aug 15 '11 at 18:43
  • @SimpleCoder I believe there is a fair amount of delay between the sending already but I am open to anything right now I will try that out. – Stephen Aug 15 '11 at 23:56
  • I'd say it's worth a shot. The problem with UDP is that there is no guarantee that each packet will be delivered. Or that each packet will be delivered in the correct order, for that matter. – Chris Laplante Aug 16 '11 at 00:50
  • @SimpleCoder I agree with that assessment entirely, but I have one issue. It is not a random packet that is received or even multiple random packets, it is ALWAYS every time I run the test the very first return packet and no matter how long I let the program run it gets none of the others. If it was random I would just chalk it up to UDP but it isn't random and it behaves the same on every network I test leading me to believe I made a programming error. – Stephen Aug 16 '11 at 02:06
  • I agree; I don't think UDP is at fault. Especially because you can see them in Wireshark. Have you tried setting breakpoints at points in `receiveUDP()` (client side), or at least `Debug.Print` statements? – Chris Laplante Aug 16 '11 at 02:17
  • 1
    Also, it couldn't be a server-side fault if the packets (according to Wireshark) do exist. – Chris Laplante Aug 16 '11 at 02:18
  • @SimpleCoder I have not ran breakpoints at the receiveUDP() line client side. I will try that today. Adding time between delivery didnt seem to affect it. I have run only run wireshark on the server, I have not tested the client but that seems like the next best step to determine which side is at fault. – Stephen Aug 16 '11 at 15:16
  • Sounds good. Please let us know if you find anything – Chris Laplante Aug 16 '11 at 15:21
  • @SimpleCoder Finally got around to testing the communications with WireShark. The Client IS receiving all of the server messages. WireShark picked up all of them coming in. The client is just not realizing they are there. – Stephen Aug 18 '11 at 22:29
  • 1
    Hmmm... My next suggestion would be to step through (breakpoints, etc) the `do while` loop on the client that listens for the packets. – Chris Laplante Aug 19 '11 at 15:57
  • @SimpleCoder Did this and found one error that was causing the whole issue! Working perfectly now thanks a bunch for the help! – Stephen Sep 05 '11 at 19:54
  • Very happy to hear that it's working! Good luck with the project! – Chris Laplante Sep 06 '11 at 21:03

0 Answers0