tags:

views:

87

answers:

1

I've got some c# code that is mapping processes to ip addresses, I'm basically trying to write some software that will look at a process and give me the ip address so that I can write a monitor that will allow friends to find be in games.

When running my application though it detects that a game process has a UDP connection but I can't seem to get the ip address.

I've run a packetsniffer and 78.111.229.123:32000 shows up on the router/gateway but it's not showing in my application.

Any ideas to get me up and running?

A: 

How are you setting up the socket in the game application? Can you post an example of your socket setup code?

Are you using the wildcard address and port when creating the socket? I'm guessing that if your game application doesn't bind to a specific IP address and port explicitly that may be the source of your problem.

Another question: are you trying to detect the local IP address, remote IP address or both?

If you're trying to detect the remote IP address this may be impossible unless the game application is using what's known as connected UDP sockets. This is where the client application calls connect on the UDP socket to create an association between the local and remote sockets in the underlying OS. This has certain advantages and drawbacks as listed in the above link.

Edit

Take a look at this SO post: PID from socket number on Windows?

This pretty much confirms what I thought - unless the game is using connected UDP sockets then the only way you'll be able to get the remote address is via packet sniffing.

Start up the game and run netstat -ap UDP - if you see that there aren't any remote addresses listed then that would confirm the above suspicion.

Robert S. Barnes
The game is call of duty 4, im trying to detect the server much like xfire does. I'm trying to detect the remote IP address.
RubbleFord
Your only option is probably packet sniffing - I assume that's what xfire is doing. See my above comment.
Robert S. Barnes