game monitor app
- From: sheldon <jeremy_sheldon@xxxxxxxxxxx>
- Date: Mon, 25 Sep 2006 05:20:57 GMT
Hello, I'm writing an app thats primary purpose is to monitor the system
for certain user specified programs. If they are discovered to be running
then the app would attempt to discover if they are connected to any
servers (like game clients connect to game servers). So far I can detect
on a Linux system if the programs are running, but determining the server
IP of the servers they are connected to has proved more difficult that I
had originally imagined.
You see, most games, and TeamSpeak for that matter, seem to use
"unconnected UDP"... um... connections. What I mean is, running a simple
'netstat' does you no good. Which brings me to my first idea:
idea 1: use the netstat code! Yes... went through it and got some
valuable info. However, like i mentioned netstat basically just gives up
if it's UDP.
idea 2: use libpcap and sniff a packet or two. I have this working...
BUT only for ROOT. Well, I want this to be a userspace program. So, this
is no good.
idea 3: use ptrace, trace the program for "sendto" syscalls and gank the
server IP. This almost works. However, there are a few issues. Firstly,
tracing the program causes unacceptable performance hits (as you can
imagine, I'm sure), so the tracing would have to be kept to a minimum.
Well, if the program runs a "connect" then it can consequently use "write"
from then on out. Therefore, if my program is polling only on occasion to
minimize performance hits and misses any initial "sendto" or "connect"s
then how can it get the server IP?
If anyone can answer that question then idea 3 might still be on the
table. Otherwise I'd appreciate any other suggestions anyone can think
of.
The idea is to make this work so that the user could specify ANY program
and it would just work (like magic). However, if I can't think of any
other ideas I may be lift to using specific client SDKs for each program
I'd want to support. This means different code for each one... I was
hoping to avoid that.
sheldon
.
- Follow-Ups:
- Re: game monitor app
- From: jasen
- Re: game monitor app
- Prev by Date: open FIFO erro
- Next by Date: Re: scope of linux in the corporates...
- Previous by thread: open FIFO erro
- Next by thread: Re: game monitor app
- Index(es):
Relevant Pages
|