Operating System - HP-UX
1843990 Members
1637 Online
110226 Solutions
New Discussion

netstat and port question

 
SOLVED
Go to solution
Carine Parmentier
Occasional Contributor

netstat and port question

Hi,
Is there anyone who can respond to my 2 outstanding questions :
- in the netstat command without any arguments, you find in the type column stream or datagram. What does stream exactly mean ?
- When you need to add your own applications in the /etc/services port list, is there a quick way to search wheather there are already some particular processes running using a portnr ?
thks for the help
Carine
6 REPLIES 6
harry d brown jr
Honored Contributor
Solution

Re: netstat and port question

man stream
man UDP

ports: http://www.iana.org/assignments/port-numbers

use lsof to find active processes: http://hpux.ee.ualberta.ca/hppd/hpux/Sysadmin/lsof-4.74/

live free or die
harry d brown jr
Live Free or Die
TwoProc
Honored Contributor

Re: netstat and port question

I think a datagram would be, for example, a request from an http server. That is a simple open connection, get request, submit reply, close connection type of sequence. In the case, the serving process knows to close the connection after the reply automatically. A STREAM would be a constant connection - like an ssh connection to another computer. A program make s a connection to a socket and it remains open and communicating (or at least communicatable) until a close is sent by the process that requested the connection.

I know its possible/probable you wanted a more technical explanation (which I don't have), but this is my impression of the difference.

Second question:
If you're asking whether or not a port is currently in use - netstat -an | grep [port_number]. Or, if it is already listed in /etc/services use - netstat -an | grep [service].
We are the people our parents warned us about --Jimmy Buffett
harry d brown jr
Honored Contributor

Re: netstat and port question

http://media.wiley.com/product_data/excerpt/31/04712328/0471232831.pdf

live free or die
harry d brown jr
Live Free or Die
Carine Parmentier
Occasional Contributor

Re: netstat and port question

Thanks for the useful answers.
John - I was not looking for the used portnr, but the processes.
I already heard about lsof, but I was wondering if you could not find it in standard HP-UX.
thks to both of you
Amit Agarwal_1
Trusted Contributor

Re: netstat and port question

lsof is not a standard HP-UX commands. You can download one from

ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/
Bejoy C Alias
Respected Contributor

Re: netstat and port question

u can use lsof -i : to check whether this port is opened and which process is using that.
e.g : lsof -i tcp:25 , will give u the PID of sendmail if a sendmail daemon is running.
lsof -i udp:53 will give u o/p as named and its PID if a dns server is running on the server
Be Always Joy ......