Server changing ports?
I finally worked out how to connect to a game server, and transfer login data, but after that, it appears the server changes ports and my connection is useless =/
Any suggestions on how to change my connected port without actually disconnecting and creating a new connection? (which I assume is bad).
(c++, with winsock)
i am guessing that you have a socket listening for a connection, and when a client tries to connect it creates a new socket to accept the connection. this is a pretty standard way of doing it, since the original listening socket can then continue listening for more connections. it doesn''t matter that the actual connection is a different port than what the client initially tries to connect to.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
um, sorry
perhaps I was unclear.
I''ve written a client. After the login procedure, IRIS tells me that on the original client, it seems to hop ports on the server. I want to emulate this, but it doesn''t work if I initiate another connection on the new port. Perhaps there''s a way to change the target port after the connection is initiated? =/

I''ve written a client. After the login procedure, IRIS tells me that on the original client, it seems to hop ports on the server. I want to emulate this, but it doesn''t work if I initiate another connection on the new port. Perhaps there''s a way to change the target port after the connection is initiated? =/
Yes. Using TCP, that is exactly how it works.
{I was confused when I wrote this section -- removed}
However, server is still listening on port X. If you want to create another connection, you still talk to port X.
I suggest getting a good primer on TCP/IP to figure out in more detail how the TCP protocol works.
EDIT: reading the additional information, it seems like you're trying to reverse engineer some protocol. If the protocol is that you first connect to X, and X tells you about Y, and you then connect to Y, then that's what you have to do. If the connection to Y is refused, then you're probably not adhering to whatever the protocol is (say, proper authentication for the protocol or similar). The specifics would be up to each protocol.
[edited by - hplus0603 on May 31, 2004 5:11:54 PM]
{I was confused when I wrote this section -- removed}
However, server is still listening on port X. If you want to create another connection, you still talk to port X.
I suggest getting a good primer on TCP/IP to figure out in more detail how the TCP protocol works.
EDIT: reading the additional information, it seems like you're trying to reverse engineer some protocol. If the protocol is that you first connect to X, and X tells you about Y, and you then connect to Y, then that's what you have to do. If the connection to Y is refused, then you're probably not adhering to whatever the protocol is (say, proper authentication for the protocol or similar). The specifics would be up to each protocol.
[edited by - hplus0603 on May 31, 2004 5:11:54 PM]
enum Bool { True, False, FileNotFound };
sorry, maybe i misread...
so the connection is made and stuff is communicated, and THEN the connection is lost? how do you know the server port changes?
quote:
connect to a game server, and transfer login data,
so the connection is made and stuff is communicated, and THEN the connection is lost? how do you know the server port changes?
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
IRIS packet analyser.
I watch the original clients packets and they go like this
SEND (IP_PORT)
RECV (IP_PORT)
SEND (IP_PORT)
RECV (IP_PORT)
SEND (IP_PORT)
RECV (IP_PORT)
etc.
then after the login is complete, the PORT has changed. I've tried to emulate this by creating a new connection and connecting to the new port, but it gets rejected.
Besides, between the login finishing, and the character data being send on the new port, there isn't any extra packets. The original client isn't sending a new connection request.
--
hplus0603, I get the hang of it now
just wondering how I change the port after the connect() has been made. target.sin_port = htons(PORT) ; does't do the business for me, because the recv() is left hanging without receving any data.
um, n/m. I get the hang of it now. Mabye some background reading would have been good before I jumped feet-first in to this ^_^ ty for the help
[edited by - mist350 on May 30, 2004 9:38:42 PM]
I watch the original clients packets and they go like this
SEND (IP_PORT)
RECV (IP_PORT)
SEND (IP_PORT)
RECV (IP_PORT)
SEND (IP_PORT)
RECV (IP_PORT)
etc.
then after the login is complete, the PORT has changed. I've tried to emulate this by creating a new connection and connecting to the new port, but it gets rejected.
Besides, between the login finishing, and the character data being send on the new port, there isn't any extra packets. The original client isn't sending a new connection request.
--
hplus0603, I get the hang of it now

um, n/m. I get the hang of it now. Mabye some background reading would have been good before I jumped feet-first in to this ^_^ ty for the help
[edited by - mist350 on May 30, 2004 9:38:42 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement