Race Sim Central
Rec.Autos.Simulators Archive

Detailed technical question about GPL multiplayer

3 posts by 2 people · 16 Oct 1998 - 16 Oct 1998

Hi. Does anyone out there (maybe even someone who had development involvement) know the exact sequence of events that occur when connecting to a GPL server? I'm trying to finally resolve the problem of connecting to a GPL server behind a gateway (in this case, my linux gateway). I know that a GPL server listens for UDP connections at port 32766 (or whatever), and then, according to what I've read here, "gives a host-assigned port for communications with the client". I'm looking for something a bit less vague. For example, is the host-assigned port number given back in a UDP reply to the source IP/port that sent the connect request to port 32766? Or does GPL send a reply back to a different but well- defined port to the source IP (that the GPL client would know/expect)? And I assume that the port that is sent back is a port on the Server that the client must use? Or is it something else? If enough details like this are known , then I think that a combination of IP masquerading and IP port forwarding in linux should be enough to allow at least 1 PC behind a linux gateway to serve as a GPL server. Having some sort of message flow diagram would be nice, too. Like this: GPL Client GPL Server 1.2.3.4 5.6.7.8 -------------------------------------------------- Send GPL-Client-Connect-Request--------------> to 5.6.7.8:32766 from 1.2.3.4:xxxx Send GPL-Client-Connect-Request-Response <------------------------------------to 1.2.3.4:xxxx (contains port number 'p' for client connection) Send GPL-Client-Connect-----------------------> to 5.6.7.8:p from 1.2.3.4:xxxx <------------------------------------Send GPL-Client-Connect-Response acknowledgement to 1.2.3.4:xxxx GPL-Client-Data-----------------------------------> to 5.6.7.8:p <-------------------------------------GPL-Server-Data to 1.2.3.4:xxxx etc..... anyway, let's get this ball rolling, and then all of us with private networks attached to the net will be able to connect to and host games (I've noticed a few other people out there with the same setup as myself). Any help appreciated... ...Andrew
SERVER: Open a datagram socket (LISTEN). SERVER: Bind socket LISTEN to port 32766 (by default) on specified IP address. CLIENT: Open a datagram socket (C). CLIENT: Bind socket C to port 0 on specified IP address. Specifying a port of 0 asks the system to choose an unused, untrusted port number (i.e. a port number > 1024). CLIENT: Using "sendto", spit a datagram at port 32766 on the server's IP address. SERVER: Sees datagram on socket LISTEN. Extracts port number and IP address of the client that sent the datagram. SERVER: Open a new datagram socket for this client (CLIENTn). SERVER: Bind socket CLIENTn to port 0 on the IP address over which the server just received this datagram. This causes the system to choose an unused, untrusted port number for this socket. SERVER: Connect socket CLIENTn to the port/IP address of the client. SERVER: Spit a datagram at the client. CLIENT: Sees datagram on socket C. Extracts the port number and IP address of the server from the datagram. CLIENT Connect socket C to this port/IP address. It's a bit more complicated, but that's the general idea. The client now talks to the server on socket C. The server now talks to client N on socket CLIENTn. The server only uses socket LISTEN to listen for new connections. This behavior mirrors the "listen"/"accept" functionality that is available with stream sockets, but is unavailable with datagram sockets. I used this mechanism because it's logical, efficient, and matches our multiplayer and communications architectures perfectly. I'm investigating ways to maintain this paradigm, but make it easier to connect through a gateway/firewall. Randy
Great. Thanks for the info, Randy. ...Andrew
Quoted text (30 lines)> SERVER: Open a datagram socket (LISTEN). > SERVER: Bind socket LISTEN to port 32766 (by default) on specified IP > address. > CLIENT: Open a datagram socket (C). > CLIENT: Bind socket C to port 0 on specified IP address. Specifying a port > of 0 asks the system to choose an unused, untrusted port number (i.e. a > port number > 1024). > CLIENT: Using "sendto", spit a datagram at port 32766 on the server's IP > address. > SERVER: Sees datagram on socket LISTEN. Extracts port number and IP > address of the client that sent the datagram. > SERVER: Open a new datagram socket for this client (CLIENTn). > SERVER: Bind socket CLIENTn to port 0 on the IP address over which the > server just received this datagram. This causes the system to choose an > unused, untrusted port number for this socket. > SERVER: Connect socket CLIENTn to the port/IP address of the client. > SERVER: Spit a datagram at the client. > CLIENT: Sees datagram on socket C. Extracts the port number and IP address > of the server from the datagram. > CLIENT Connect socket C to this port/IP address. > It's a bit more complicated, but that's the general idea. > The client now talks to the server on socket C. > The server now talks to client N on socket CLIENTn. > The server only uses socket LISTEN to listen for new connections. This > behavior mirrors the "listen"/"accept" functionality that is available with > stream sockets, but is unavailable with datagram sockets. I used this > mechanism because it's logical, efficient, and matches our multiplayer and > communications architectures perfectly. I'm investigating ways to maintain > this paradigm, but make it easier to connect through a gateway/firewall.

Sponsors

Affiliate Links

Sim Gaming Expo MOZA Racing Sim-Lab Fanatec TrakRacer Asetek Internet Privacy From NordVPN Dreamhost Capital One Credit Card Application Fanatical CDKeys Amazon Amazon UK Project Motor Racing iRacing Get your racing gloves, boots and more from Demon Tweeks. Enlist at Roberts Space Industries, developers of Star Citizen and Squadron 42


Back from the ashes since July, 2019. First created in 2001 with the merger of Legends Central (founded 1999) and simracing.dk.

A site by a sort of sim racer, for sim racers, about racing sims. News and information on both modern and historic sim racing software titles.

All products and licenses property of their respective owners.


Facebook Threads Bluesky Twitter Mastodon Instagram YouTube Tiktok Twitch Reddit Google News Apple News Subscribe via WordPress Flipboard eBay

Race Sim Central © 1999-2026 | Some links pay RSC a commission. Advertising does not equal endorsement.Cookie Policy