Re: Using Distributed Objects in an Internet-Game
Re: Using Distributed Objects in an Internet-Game
- Subject: Re: Using Distributed Objects in an Internet-Game
- From: "Alastair J.Houghton" <email@hidden>
- Date: Mon, 18 Aug 2003 18:38:33 +0100
On Monday, August 18, 2003, at 05:58 pm, Theome wrote:
So here are my first questions: If I connect to a Q3A server in the
internet
from 3 macs in my LAN, on which ports are they listening for incoming
packets? How does the NAT-server know that the incoming packets on
those
three different ports have to be forwarded to the clients in the LAN?
It knows because it saw the outgoing connections in the first place;
the NAT server allocates its own port numbers on the outgoing side...
for example:
1. Our Mac decides to connect to an Internet site on port 80 (HTTP).
It creates a TCP socket and gives it the port number 8103.
2. The NAT gateway sees the outgoing connection request, remembers that
it came from Mac A on port 8103 and assigns the request *its own port
number*... say 9832. The packet is munged so that the source address
is the NAT gateway's address, and the source port is this new port.
3. The Internet site receives a connection request apparently *from the
NAT gateway* on port 9832. It acknowledges to complete the
connection, using the port number the client was trying to connect to
(80, in this case).
4. The NAT gateway receives the acknowledgement from the Internet site,
spots that it is being sent to port 9832, looks-up where that port
number should be forwarded to and finds that it should be sent to our
Mac on port 8103. It then munges the packet, replacing the port number
and destination address and sends it on to the Mac.
Obviously it's a bit trickier with connectionless rather than
connection-oriented protocols, because there is no connection as such;
some NAT implementations support this by pretending that a connection
is established by the first outgoing datagram, and timing it out after
the router hasn't seen any traffic that it thinks belongs to the
connection for a while.
My game is working in the local network without problems, but doesn't
work
over the internet. I hope there is a way that I only need to forward
*one*
port on my NAT server to the *one* mac that is hosting the game, and
that
other macs from the internet, maybe connected through another router,
can
connect to my mac *without* configuring any network stuff (as it works
great
for most games - quake 3, diablo 2 etc - you just need to click
"join"; no
network configuring is needed).
I don't know enough about Distributed Objects to really comment on the
viability of using it for this purpose. But NAT routers will generally
work fine as long as the protocols being used do not send IP addresses
and port numbers in the data portion of the packets; of course, several
widely-used protocols do that (including FTP), and NAT routers
typically have special support for those protocols.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.