UDP problems

M

Matti Paalanen

Greetings!

I have question regarding udp-communications.

I've made a simple Gravity Force -style game with netgame option using
UDP but I'm having strange problems with connections. I first tested
the network-game by spawning two different instances of the game
program on my computer and then made the connection between them using
my local ip. Game worked fine.

But when I try to play the game with friends over internet, strange
problems evolve: When a friend of mine hosts the game and opens a
port, messages I send arrive safely without any problems, but none of
the messages he sends arrive to my end. The host checks the ip from
the first arriving packet and uses it in the communication.
(DatagramPacket in and in.getAddress()) The port all clients are using
as the receiving one is 44444 and this is hardcoded into server also.

Well, we tried different combinations with a few friends, and then
suddenly two of them were able to estabilish communication and were
able to play the game normally. Two other couldn't get any of the
messages to arrive.

I also made TCP version, and none of us had any problems with
connections, but the game was of course pretty laggy, so UDP is the
only reasonable choice.

Another weird thing (at least I think it's weird) is that I can ping
and traceroute the friends from whom i can't receive any packets, and
they can ping and traceroute me.

So what would be the best way to advance from here? My software
firewall never complains about any messages, so it's quite evident
that the messages stop at my friends host when going outwards, or at
my host before coming to my adsl-modem. I don't know much about
restrictions and port-politics, so should I change the port numbers or
what would be the reason for this kind of lack blocking? Is it common
that UDP traffic is completely cut off this way?

-Matti Paalanen
 
T

Thomas Jollans

Matti said:
Greetings!

I have question regarding udp-communications.

I've made a simple Gravity Force -style game with netgame option using
UDP but I'm having strange problems with connections. I first tested
the network-game by spawning two different instances of the game
program on my computer and then made the connection between them using
my local ip. Game worked fine.

But when I try to play the game with friends over internet, strange
problems evolve: When a friend of mine hosts the game and opens a
port, messages I send arrive safely without any problems, but none of
the messages he sends arrive to my end. The host checks the ip from
the first arriving packet and uses it in the communication.
(DatagramPacket in and in.getAddress()) The port all clients are using
as the receiving one is 44444 and this is hardcoded into server also.

Well, we tried different combinations with a few friends, and then
suddenly two of them were able to estabilish communication and were
able to play the game normally. Two other couldn't get any of the
messages to arrive.

I also made TCP version, and none of us had any problems with
connections, but the game was of course pretty laggy, so UDP is the
only reasonable choice.

Another weird thing (at least I think it's weird) is that I can ping
and traceroute the friends from whom i can't receive any packets, and
they can ping and traceroute me.

So what would be the best way to advance from here? My software
firewall never complains about any messages, so it's quite evident
that the messages stop at my friends host when going outwards, or at
my host before coming to my adsl-modem. I don't know much about
restrictions and port-politics, so should I change the port numbers or
what would be the reason for this kind of lack blocking? Is it common
that UDP traffic is completely cut off this way?

-Matti Paalanen

sounds like something in the firewall, as you don't get any errors just
the packet gets lost. i don't think a port change would help as you are
probably using s port that is not likely to be used anyway, so either
it's open or shut (for security). you obviously can't use any standard
port as it may be used. i would firsttry shutting down the personal
firewall and then (if it doesn't work) use tcp (although that is slo)

thomas
 
K

Knute Johnson

Thomas said:
sounds like something in the firewall, as you don't get any errors just
the packet gets lost. i don't think a port change would help as you are
probably using s port that is not likely to be used anyway, so either
it's open or shut (for security). you obviously can't use any standard
port as it may be used. i would firsttry shutting down the personal
firewall and then (if it doesn't work) use tcp (although that is slo)

thomas

Are you behind a router? If so you need to forward port 44444 to your
specific computer.
 
M

Matti Paalanen

I got it sorted out. I still can't host game because of NAT probably,
but I can now connect to hosted game and packets from host arrive at
my end. There was actually a mistake in my code. At host end, I didn't
get port number from the packet but used a hardcoded one, which all
clients use. But of course the NAT changes the port in between and
host has to use that port in response. Anyway, getting the port from
the packet would be the "right decision" in any case, so it was my
total mistake. Ok, now the next step is to try playing a group game
and check the lag. Hopefully it will be unnoticeable.

-Matti
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top