Re: Get process that bind a port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 30 November 2005 12:54, STYMA, ROBERT E (ROBERT) wrote:
> > Hello,
> > I am playing around with writing a program to bind to socket
> > / port in my
> > machine. Often time, I got the message:
> > bind(): Address already in use
> >
> > So my question is, how do I find out which process bind to a
> > certain port
> > number ? 

> The command lsof run as root will tell you a lot of things including
> who is bound to a port.
> For example:
> lsof | grep 2345

Great. Thanks.

> Note that on various flavors unix, I have seen the "already in use" message
> for a short time after a program exits.  That is, start a program which
> listens on a certain port, exit the program, immediately restart the
> program.  A quick test says FC4 does not seem to do this.

The reason I am asking is because I am seeing exactly this on FC 4. It seems 
that after exiting, the program does not release the port immediately, and 
hence restarting the program get the "already in use" message, while 'ps aux 
| grep progname' shows nothing. Maybe I am doing something wrong, ie. the 
program does not release the port cleanly on exit or something like that ? 
I'm not sure...

Thanks a lot for the answer though .
RDB


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux