Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-29-2004, 01:13 AM   #1
Registered: May 2003
Distribution: Debian
Posts: 40

Rep: Reputation: 15
Network Programming Questions - please help

Hi all,

There are a few things i'll need for my next programming project. Code snippets and/or pointers to relevant documentation would be greatly appreciated.

I need code/shell scripts/anything that can achieve one or all of the following:

1. List all open ports on the machine (is there a more low-level way than a portscan?)
2. Find out which program/process ID is associated with each open port.
3. Find out how much bandwidth each open port uses (would that have to be done by IP accounting?)
4. Attach handler functions to be called (a) before a process opens a port, and (b) after a port is closed.
5. Find out about all currently active network connections and the relevant programs/process IDs (note - this is more than just 1&2, since for server ports you can have several connections per port)

I'd be grateful for any help/ideas you might have.



Old 03-29-2004, 01:04 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
I'm unsure about 4 - I'll move this to Programming as you are likely to get better responses there.

For all others you can use netstat. For example:
netstat -anp
Old 03-29-2004, 02:37 PM   #3
Registered: May 2003
Distribution: Debian
Posts: 40

Original Poster
Rep: Reputation: 15
Thanks for the reply, reading the friendly man-page

The answer to 4 would be of particular interest.............


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
questions about programming... efm Programming 12 11-29-2005 01:58 PM
2 programming questions hk_michael Programming 4 02-01-2005 12:02 AM
where to get PL/SQL programming questions? AskMe Programming 2 11-14-2003 10:50 AM
programming questions eboats Linux - General 19 10-22-2001 05:15 PM
programming questions eboats Programming 4 10-17-2001 02:15 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration