🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: 'could not bind socket' error

#657
From: Dennis Jones
Date: Tue, 18 Dec 2007 01:01
121 lines
7680 bytes
----- Original Message ----- 
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Sent: Tuesday, November 20, 2007 11:07 PM
Subject: Re: 'could not bind socket' error


>>> In this particular case, the port number was 5018.
>>
>> And port 5018 does not appear anywhere in netstat -a or -b for any IP
>> address or hostname while the error is occuring?
>
> Yes, that is correct.  That's what's so frustrating about the whole thing. 
> If netstat -a showed me that the port was in use, then at least I would 
> know where to start looking.  But since it doesn't, I don't know if the 
> problem is due to my application (failing to close the socket correctly in 
> some unusual circumstance), or the OS doing something funky, or if it is 
> something else entirely.
>
> I guess all I can do now is wait until it happens again and then see if I 
> can find some way to figure out what's causing it.  Any suggestions on how 
> to go about doing would be most welcome.  In the meantime, do you know of 
> any way to clear the socket so that the IP/port can be used without having 
> to reboot the machine?

Okay, it happened again.  My application failed to open a socket on port 
5018.  I immediately went to a command prompt and invoked "netstat -a". 
Here is the output (some identifying address information has been blocked 
out).  You will note that there is no entry for port 5018 anywhere in the 
list, and yet I get "Could not bind socket. Address and port are already in 
use."  I also checked all of the named ports to discver their numeric 
equivelent.  None of them are port 5018.

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    djones_xp:epmap        djones_xp:0            LISTENING
  TCP    djones_xp:microsoft-ds  djones_xp:0            LISTENING
  TCP    djones_xp:902          djones_xp:0            LISTENING
  TCP    djones_xp:912          djones_xp:0            LISTENING
  TCP    djones_xp:1030         djones_xp:0            LISTENING
  TCP    djones_xp:2401         djones_xp:0            LISTENING
  TCP    djones_xp:3389         djones_xp:0            LISTENING
  TCP    djones_xp:8222         djones_xp:0            LISTENING
  TCP    djones_xp:8333         djones_xp:0            LISTENING
  TCP    djones_xp:1066         djones_xp:0            LISTENING
  TCP    djones_xp:2402         djones_xp:0            LISTENING
  TCP    djones_xp:3690         djones_xp:0            LISTENING
  TCP    djones_xp:4564         localhost:4565         ESTABLISHED
  TCP    djones_xp:4565         localhost:4564         ESTABLISHED
  TCP    djones_xp:4566         localhost:4567         ESTABLISHED
  TCP    djones_xp:4567         localhost:4566         ESTABLISHED
  TCP    djones_xp:10025        djones_xp:0            LISTENING
  TCP    djones_xp:10110        djones_xp:0            LISTENING
  TCP    djones_xp:10110        localhost:1419         TIME_WAIT
  TCP    djones_xp:10110        localhost:1421         TIME_WAIT
  TCP    djones_xp:10110        localhost:1423         TIME_WAIT
  TCP    djones_xp:10110        localhost:1425         TIME_WAIT
  TCP    djones_xp:10110        localhost:1427         TIME_WAIT
  TCP    djones_xp:10110        localhost:1430         TIME_WAIT
  TCP    djones_xp:10110        localhost:1432         TIME_WAIT
  TCP    djones_xp:10110        localhost:1436         TIME_WAIT
  TCP    djones_xp:10110        localhost:1438         TIME_WAIT
  TCP    djones_xp:10110        localhost:1440         TIME_WAIT
  TCP    djones_xp:62332        djones_xp:0            LISTENING
  TCP    djones_xp:netbios-ssn  djones_xp:0            LISTENING
  TCP    djones_xp:netbios-ssn  192.168.1.50:3572      ESTABLISHED
  TCP    djones_xp:1025         192.168.1.2:microsoft-ds  ESTABLISHED
  TCP    djones_xp:1027         neutron:microsoft-ds   ESTABLISHED
  TCP    djones_xp:1037         207.224.24.86:2108     ESTABLISHED
  TCP    djones_xp:1069         cs21.msg.dcn.yahoo.com:5050  ESTABLISHED
  TCP    djones_xp:1071         by1msg3145602.phx.gbl:1863  ESTABLISHED
  TCP    djones_xp:1073         205.188.9.108:5190     ESTABLISHED
  TCP    djones_xp:1076         oam-d19c.blue.aol.com:5190  ESTABLISHED
  TCP    djones_xp:1396         by2msg1262105.phx.gbl:1863  ESTABLISHED
  TCP    djones_xp:1420         incoming.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1422 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1424 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1426 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1428 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1429         209.213.221.138:4050   TIME_WAIT
  TCP    djones_xp:1431         incoming.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1437 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1439 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:1441 
static-xx-xxx-xxx-xx.ptldor.fios.verizon.net:pop3  TIME_WAIT
  TCP    djones_xp:2315         neutron:2324           ESTABLISHED
  TCP    djones_xp:3243         soft-gems.net:nntp     ESTABLISHED
  TCP    djones_xp:3978         aqaserver.automatedqa.com:nntp  ESTABLISHED
  TCP    djones_xp:4025         nexusdb.com:nntp       ESTABLISHED
  TCP    djones_xp:4265         207.105.83.62:563      ESTABLISHED
  TCP    djones_xp:4605         qb-in-f99.google.com:http  CLOSE_WAIT
  TCP    djones_xp:4686         192.168.1.2:5900       ESTABLISHED
  UDP    djones_xp:epmap        *:*
  UDP    djones_xp:microsoft-ds  *:*
  UDP    djones_xp:isakmp       *:*
  UDP    djones_xp:1029         *:*
  UDP    djones_xp:1035         *:*
  UDP    djones_xp:1494         *:*
  UDP    djones_xp:2241         *:*
  UDP    djones_xp:3343         *:*
  UDP    djones_xp:3456         *:*
  UDP    djones_xp:4500         *:*
  UDP    djones_xp:5353         *:*
  UDP    djones_xp:ntp          *:*
  UDP    djones_xp:1900         *:*
  UDP    djones_xp:2636         *:*
  UDP    djones_xp:4373         *:*
  UDP    djones_xp:ntp          *:*
  UDP    djones_xp:netbios-ns   *:*
  UDP    djones_xp:netbios-dgm  *:*
  UDP    djones_xp:ntp          *:*
  UDP    djones_xp:1900         *:*

- Dennis 
Technical Details
Message-ID: <47671be8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <47431d9f$1@newsgroups.borland.com> <474342ce@newsgroups.borland.com> <47434723$1@newsgroups.borland.com> <474358f3@newsgroups.borland.com> <47436c88$1@newsgroups.borland.com> <474377e3$1@newsgroups.borland.com> <474384f3$1@newsgroups.borland.com> <4743c58d$1@newsgroups.borland.com> <4743d916$1@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> <47434723$1@newsgroups.borland.com> <474358f3@newsgroups.borland.com> <47436c88$1@newsgroups.borland.com> <474377e3$1@newsgroups.borland.com> <474384f3$1@newsgroups.borland.com> <4743c58d$1@newsgroups.borland.com> <4743d916$1@newsgroups.borland.com>
Subject: Re: 'could not bind socket' error
Date: Mon, 17 Dec 2007 17:01:30 -0800
Lines: 123
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 71.245.109.58
Message-ID: <47671be8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1197939688 71.245.109.58 (17 Dec 2007 17:01:28 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail