Using Distributed Objects in an Internet-Game
Using Distributed Objects in an Internet-Game
- Subject: Using Distributed Objects in an Internet-Game
- From: Theome <email@hidden>
- Date: Mon, 18 Aug 2003 18:58:42 +0200
Hi,
I'm currently developing a small network game and ran into some problems.
The game is server-client based - one server is set up and up to 4 clients
can connect.
My client needs to send messages to the server, and - of course - the server
needs to send messages back to all clients. I don't know how to set up the
NSSocketPorts and the NSConnections that every client has a working proxy
from the server and the server has a proxy for every client (Distributed
Objects).
The macs in my LAN are connected to the internet through a local NAT-server.
As far as I know, I can join most games (e.g. Quake 3 Arena) as a client
without mapping ports from the NAT-server to my mac. Only if I want to host
a game server, the router has to forward messages that are received on port
27960 (Q3A default port) to my local ip address (something like
192.168.1.30).
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?
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).
Until now, I use the following methods to initialize the ports and
connections:
- (id)initWithTCPPort:(unsigned short)port
- (id)initRemoteWithTCPPort:(unsigned short)port host:(NSString *)hostName
+ (NSConnection *)connectionWithReceivePort:(NSPort *)receivePort
sendPort:(NSPort *)sendPort
Do you have any ideas?
Thanks a lot in advance,
Theodor M|ller.
_______________________________________________
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.