LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-03-2009, 12:18 AM   #1
Hims
LQ Newbie
 
Registered: Feb 2009
Posts: 1

Rep: Reputation: 0
Error : Adderss is already in use.


hi, i am new in the LINUX platform,i am trying to communicate between the server and a client.First time the program executed and i got the output but from second time an error message is coming that Address is already in use.
if((rc = setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) < 0);
this function is returning -1,
if the port is in use, then how to resue the port.
i am totally in dark please help me.

Last edited by Hims; 02-03-2009 at 12:20 AM.
 
Old 02-03-2009, 03:04 AM   #2
jimvin
Member
 
Registered: May 2004
Posts: 71

Rep: Reputation: 15
Hi,
If it worked the first time and not the second then I suggest that the first instance of the program is still running. This would account for the port still being in use. Check the process list using ps to see if there is a copy of the program running.

You can use netstat to show you what is listening on each port:

netstat -nap

Regards,
Jim
 
Old 02-04-2009, 01:06 PM   #3
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
If you know the port number (e.g., 4711) "lsof -i :4711" can be very helpful. I think "lsof" is "list open files" -- it can answer that, too. Run as root if you don't own the process that's listening on :4711, otherwise lsof won't tell you.

Probably you get the same information as from netstat, but I find lsof easier to use.
/Quigi
 
  


Reply



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
PHP Error Parse error: parse error, unexpected $ in /home/content/S/k/i/SkinCare4U/h CowanServices Programming 2 12-09-2008 08:26 PM
dhcpcd not getting ip adderss w/ wpa_supplicant jim_fields Linux - Wireless Networking 1 07-07-2008 10:23 PM
ip adderss problem soumalya Solaris / OpenSolaris 16 07-02-2008 11:40 PM
Suse CUPS error: cups(File)DoRequest error:client-error-bad-request smdonelan Linux - Hardware 6 04-17-2007 06:46 PM
updating new installation of 9.3 ERROR...ERROR...ERROR Morbid SUSE / openSUSE 3 08-15-2005 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:49 PM.

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