The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ldap bind error mridula High Level Programming 2 12-06-2005 02:13 PM
lpthread error when trying to compile static BIND MixmasterMike UNIX for Advanced & Expert Users 0 07-25-2005 08:25 PM
Sending Error msg from HP-UX to E-mail address cgege HP-UX 1 08-05-2004 03:41 AM
bind() error Virtuosso IP Networking 2 06-07-2002 02:17 AM
Error "Cat Error: Bad Address " ss_hpov Shell Programming and Scripting 1 04-03-2002 03:07 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-24-2006
Registered User
 

Join Date: Sep 2005
Posts: 13
how to solve error : Bind: Address Already in Use

hi
i have created socket program with proper IP address and port no
client side port no 1085[listen] and 1086[send]
gateway side port no 1086[listen_to_client] and 1085[send_to_client]
and port no 1087[listen_to_receiver] and 1088[send_to_receiver]
receiver side port no 1088[listen_to_client] and 1087[send_to_client]
well it works fine on client and gateway side not on receiver and gateway side it gives error on address binding.
can any one suggest why this happing so
when this bind error comes

thankx

Last edited by bhakti; 07-24-2006 at 02:43 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-24-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
The error is clear: The IP/port are in use.
Try to gess what, among all the ports your app uses, is the one in use.
To do so, use lsof if it's available on your system or netstat if it's not.
Regards.
Reply With Quote
  #3 (permalink)  
Old 07-27-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 356
Sometimes you try to bind() and have an error "Address already in use".
Someone is still handling the port. You can either wait for it to clear (a minute or so), or add code to your program allowing it to reuse the port:
Code:
int tr=1;

// kill "Address already in use" error message
if (setsockopt(listener,SOL_SOCKET,SO_REUSEADDR,&tr,sizeof(int)) == -1) {
    perror("setsockopt");
    exit(1);
}
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0