🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #718

Re: 'could not bind socket' error

#718
From: Dennis Jones
Date: Tue, 20 Nov 2007 20:44
43 lines
2830 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:474342ce@newsgroups.borland.com...
>
> "Dennis Jones" <nospam@nospam.com> wrote in message 
> news:47431d9f$1@newsgroups.borland.com...
>
>> I have an application which frequently fails to start with the message:
>>
>> "Could not bind socket. Address and port are already in use."
>
> That happens when you specify a local IP/Port to bind the socket to before 
> opening it, but the IP/Port is already in use by another socket.

Right, I am pretty sure I understand what the error means, I just don't 
understand *why* I am getting it.


>> The application had not been running for at least a day, and no
>> other server applications use the same port.
>
> So this error is happening for a server socket and not a clien socket?  Is 
> there anotehr instance of the app already running?

Yes, that is correct, it is a server socket.  But no, there are no other 
instances of the application running, which is why the I'm asking the 
question.  (the application uses a mutex to prevent multiple instances)


>> I have checked "netstat -a" for any indication that the port is in
>> use, but am never able to find anything.
>
> Why not?

If I knew the answer to that, I wouldn't be asking the question in the first 
place!!  That's the whole point..."netstat -a" does not show any application 
instances that reference the port number I am trying to open in my server. 
So if netstat does *not* show the port is in use, why would the server 
socket complain that it *is* in use?  That's the essence of my question.  I 
can find no indication whatsoever that the port is in use, yet the server 
complains.  How can that be?

- Dennis 
Technical Details
Message-ID: <47434723$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder2.cambrium.nl!feed.tweaknews.nl!193.201.147.86.MISMATCH!news.astraweb.com!border1.a.newsrouter.astraweb.com!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47431d9f$1@newsgroups.borland.com> <474342ce@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,128d041863311899
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <47431d9f$1@newsgroups.borland.com> <474342ce@newsgroups.borland.com>
Subject: Re: 'could not bind socket' error
Date: Tue, 20 Nov 2007 12:44:20 -0800
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 71.245.109.58
Message-ID: <47434723$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1195591459 71.245.109.58 (20 Nov 2007 12:44:19 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder2.cambrium.nl!feed.tweaknews.nl!193.201.147.86.MISMATCH!news.astraweb.com!border1.a.newsrouter.astraweb.com!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail