views:

76

answers:

2

I'd like to create an application that gets the ipv4 tcp table ( currently by using GetTcpTable() ), then gets a socket (searching for a particular IP address) and peeks data from that connection (it actually has to send data too).

So we have two processes on the same machine, one that has a connection to a server, and another one that exploits that connection to peek/send data from it.

Is it possible to use a socket created by another process?

I am writing an add-on application for a videogame, and need to "talk" to the server the game is connected to.

+1  A: 

There is not, in general, a commonly available method to do this. One approach might be to write a man-in-the-middle process (also known as a "proxy"), where you set up the game to connect to your program, then you connect to the game server. All communications between the game and the server would then go through your application, and you can inspect and modify data at will.

Greg Hewgill
Mh.. that's interesting but there is a tool (called "EasyUO") that is started after running the game and can send commands directly to the server.. Do you know how can I achieve the same result? If it cannot find and use the same socket the game opened, how can it send commands directly to the server? (I'm not a cheater, ultima online has always been extended by other applications, I'm trying to create one of that ones..)
IceCoder
+1  A: 

No it is not possible.

The best you could do is write a proxy for the game server and have the client connect to the proxy instead. Then, all communications to the server would go through the proxy and you'd be able to inject your own commands anyway.

Typically, the game would use DNS to find the server. So to create a proxy it's usually a fairly simple matter of adding an entry for the game's DNS and redirecting that to 127.0.0.1. Launch your proxy to run on the same port as the game server and what'll happen is that the game will resolve the server's DNS to your proxy instead.

Dean Harding