🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Local Address of Server Socket

#4845
From: Remy Lebeau (TeamB)
Date: Sat, 27 Nov 2004 10:14
31 lines
2081 bytes
"Dev Support" <infsoft@centurytel.net> wrote in message
news:41a7cc27$1@newsgroups.borland.com...

> The following code...
<snip>
> Produces the output of ...
>
> "0.0.0.0 Listening..."

An address of "0.0.0.0" means that the server is listening on all available
IP addresses, not any one specific address.

> I've run the ipconfig program and my machine is getting an IP
> address from a DHCP server and my chat program IS working
> except for this one trace/troubleshooting item?????

You have to wait until a client connects to the server in order to know
which IP the client used to reach the server.  Place your code into the
OnConnect event instead of the OnListening event.  Also, you need to query
the LocalAddress of the Socket parameter of the event handler, not the
Socket property of the server.  They are not the same socket.

    void __fastcall TForm1::ServerSocket1Listen(TObject *Sender,
TCustomWinSocket *Socket)
    {
        Memo3->Lines->Add(" Connected to " + Socket->LocalAddress + "...");
    }


Gambit
Technical Details
Message-ID: <41a852fc$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41a7cc27$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,da4f1b54b80c98d
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41a7cc27$1@newsgroups.borland.com>
Subject: Re: Local Address of Server Socket
Date: Sat, 27 Nov 2004 02:14:27 -0800
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <41a852fc$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1101550332 68.69.17.41 (27 Nov 2004 02:12:12 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail