Forwarding a connection?

Started by
2 comments, last by bilsa 18 years, 4 months ago
Hey guys! If I have something like this: LoginServer.exe GameServer.exe Client.exe Is there any way to do this: 1. Client.exe connects to LoginServer.exe with ip:192.192.192.192 port:9999 2. Client.exe requests to login 3. LoginServer.exe checks that the login was successful and sends the result back to Client.exe Now comes the part I'm not sure is possible to do: (at least I don't know how) 4. I want LoginServer.exe, which already has accepted a tcpip connection with the Client.exe, to "forward" the connection to GameServer.exe. I know I could just send the packets to the GameServer.exe, but that would make both LoginServer.exe AND GameServer.exe get the same packets :( So I would want to "forward" the connection to GameServer.exe so that the Client.exe speaks directly to GameServer.exe instead of LoginServer.exe And the tricky part is that I have no means to change the Client.exe, so I can't just disconnect from LoginServer.exe and connect with GameServer.exe. So the Client.exe must basically "think" that it's speaking to LoginServer.exe I can only change the LoginServer.exe and GameServer.exe Is this possible to achieve? Thx !
Advertisement
There is no way to "forward" a connection. You either need to create a separate connection from LoginServer to GameServer to forward the packets, or you need to tell the client to re-connect to GameServer (and disconnect it from LoginServer).

If you want to make sure that the client has been authenticated by LoginServer, you can take a look at my authentication article.
enum Bool { True, False, FileNotFound };
You could always make the login server a proxy for the game server but that's just a really bad idea. Just make another connection.
Thx guys!

Actually I would disconnect/reconnect, if I could... but this is for a game server emulator I'm doing, so I don't have that option :)

I can't actually recompile the client... and the official server-client is designed
so stupidly that the login-server and game-server is on the same ip and port -
thus it must be a single application.

Anyway, this is a sollution I came to think of:

1. Make a Client.exe that each player needs to start up the game with
2. The actual game.exe connects to the Client.exe, which is on the users
computer. The game.exe only speaks to the Client.exe.
3. The Client.exe can then freely connect/disconnect to/from any server
of it's choice.

This makes it possible to have separate applications for Login server and
game server and ai server etc :)

Anyway, thank you!

[Edited by - bilsa on December 3, 2005 11:29:02 AM]

This topic is closed to new replies.

Advertisement