February 4th, 2005, 12:48 PM
I'm new to python and I have a problem to solve using python:
Basically, I want to write a small program, which runs on a designated port, and returns a complete listing of all network connections (using netstat) back to the designated port.
From my limited experience with Python I assume I need to:
1. import socket library
2. create a stream socket
3. open a specific port for connections
4. tell the socket to wait & listen for clients
5. during this time I accept client connections & grab network info using netstat
6. close the connection when done
Any help would be gratefully appreciated.
February 4th, 2005, 02:09 PM
Makes sense, you could also create a web service although thats probably overkill depending on what your doing. In either case you should use the subprocess module to get the results from 'netstat'. Here are a few links that you might find useful:
If you have any questions ask away,
February 4th, 2005, 03:43 PM
Alternatively you could run it as an XML-RPC service. This would enable you to use SimpleXmlRpcServer to handle all the low-level code, and it would be callable from any language that supported XML-RPC.
DAve - The Developers' Coach