From: Ulrich Eckhardt on
Greg2fs wrote:
> I was thinking about NAT, after some tests it seems that the best
> choici is to use the same port for client and server, this way it
> seems to work better and there is no upnp.

I'm not sure what the client/server ports have to do with that.

> But suppose that we get the server (1.1.1.1), a client with one pc
> (2.2.2.2), the client with two pc (3.3.3.3)
> -the first client call the server and the server reply to the same ip/
> port there's no problem.
> -then the second client call the server with his fist pc and the
> server reply the same way... still no problem
> -but now the second client call the server with his second pc, will
> the server be able to reply has the same ip/port combinason already
> exists for the first pc ?

One note on terminology: When you say "client", you actually mean "customer"
or "player", right? The point is that the term "client" is actually used
for something different in networking and it's a bit confusing. :)

Anyway, if two machines are behind an NAT, to the outside they will have the
same IP address. If they now send UDP packets from the same port, the
recipient will not be able to tell which machine the packet came from,
assuming the NAT doesn't change the source port. So, when replying to that
port, the NAT will not be able to tell where that response should go to
either.

For some protocols built upon IP, NATs sometimes have special handlers, e.g.
for TCP, FTP or DDC. Since you probably don't use either of these common
ones, I'm afraid you won't be able to get your traffic routed correctly by
the NAT.

Suggestion 1: Use TCP. TCP is connection-based and it all simply works
reliably and through any NAT.

Suggestion 2: Use a TCP connection to negotiate a UDP port. That would allow
different clients to use different ports, which would then give the NAT a
chance to route the traffic correctly.

Good luck!

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

From: David Schwartz on
On Feb 22, 4:32 am, Greg2fs <greg...(a)gmail.com> wrote:

> I was thinking about NAT, after some tests it seems that the best
> choici is to use the same port for client and server, this way it
> seems to work better and there is no upnp.

I think that would be a huge mistake. Why *require* the client to use
a particular port? There is no rational reason for that requirement.

> But suppose that we get the server (1.1.1.1), a client with one pc
> (2.2.2.2), the client with two pc (3.3.3.3)
>  -the first client call the server and the server reply to the same ip/
> port there's no problem.
>  -then the second client call the server with his fist pc and the
> server reply the same way... still no problem
>  -but now the second client call the server with his second pc, will
> the server be able to reply has the same ip/port combinason already
> exists for the first pc ?

Exactly. That's why it's silly to require the client to use a
particular port. Let the client use whatever port is free.

DS