Author Topic: SendQuickly not sending UDP packets in Example #3  (Read 2665 times)

VirindiTim

  • Guest
SendQuickly not sending UDP packets in Example #3
« on: February 27, 2013, 02:27:21 AM »
Hi,

I have installed TNServer on a virtual machine running on the Azure Cloud.  When I run the example scenes from within the Unity IDE on my workstation and point them at my cloud server I am experiencing a problem with Example #3 (dragging/moving the cubes).  I can run Example 1 and 2 just fine and the chat example works fine as well.

However, when I run Example #3 and drag the cubes I don't see the cubes moving in real-time on the other client machines.  As I drag the cube across the screen, the associated cube on the other client machines does not move until I complete the drag event by releasing the mouse. Only then does the position of the cube update properly on the other game clients.

I saw that the following code is being executed when the cubes are being dragged:

void OnDrag (Vector2 delta)
{
   if (mOwner == TNManager.player)
   {
      mTarget = TouchHandler.worldPos;

      // Here we send the function via "SendQuickly", which is faster than regular "Send"
      // as it goes via UDP instead of TCP whenever possible. The downside of this approach
      // is that there is up to a 4% chance that the packet will get lost. However since
      // this update is sent so frequently, we simply don't care.
      tno.SendQuickly(3, Target.OthersSaved, mTarget);
      print ("sendquickly");
   }
}

I added the print command to verify that the SendQuickly method is being called as expected in response to OnDrag events (which it is).

However, when I run a packet sniffer on my server, I'm not seeing any UPD packets being transmitted when I am dragging the cube in the example.  The comments for the SendQuickly function imply that it will send via UDP, but I'm not seeing any UDP traffic on my server over the UDP game server port.

I do see the expected TCP traffic for all of the other examples and they work fine.  I also see the UDP traffic as expected for the chat example.  I just don't see the UDP packets coming from the SendQuickly method in Example 3.

Any ideas on what the problem may be?

I have disabled windows firewall on my VM server and opened the appropriate endpoints on the Azure portal.  I am starting TNServer on my VM with the following command line:  TNServer.exe "Virindi" 5127 5128 5129

Thanks
« Last Edit: February 27, 2013, 02:30:20 AM by VirindiTim »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SendQuickly not sending UDP packets in Example #3
« Reply #1 on: February 27, 2013, 08:57:02 AM »
Try hosting the server locally instead of on the VM. Perhaps are your VM doesn't support UDP or it's just not set up to use it.

VirindiTim

  • Guest
Re: SendQuickly not sending UDP packets in Example #3
« Reply #2 on: February 27, 2013, 11:41:03 AM »
At first, I thought it must be an issue with the Azure VM not allowing UDP.  However, the Chat example works just fine (which uses UDP) so I found it odd that UDP works for the Chat example but not Example #3.

On my server VM I have opened ports 5128 (game server) and 5129 (chat).  The chat UDP works, Example #3 doesn't.

I will test some more tonight and if I can resolve the issue will post the solution here.  I'll start by verifying whether Example 3 works with a local server and move on from there.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SendQuickly not sending UDP packets in Example #3
« Reply #3 on: February 27, 2013, 08:46:43 PM »
Chat example uses TCP.