Article View: borland.public.cppbuilder.nativeapi
Article #9450Win API to peek next tcp local port
From: OzJohn
Date: Thu, 08 Jul 2004 05:14
Date: Thu, 08 Jul 2004 05:14
11 lines
1330 bytes
1330 bytes
I have an app where I need to see which local port will be granted when one is next requested. I use the following to obtain the local port number last allocated ...
ServerSocket1->Open(); //.. a TServerSocket component
TServerWinSocket* Socket = ServerSocket1->Socket;
long myLocalPort = Socket->LocalPort;
ServerSocket1->Close();
Although this works, it's wasteful since every time I use it, it uses up a local pot number. Is there a way to peek at what will next be allocated without actually using a local port number.
OzJohn
Technical Details
Message-ID:
<40ecd826$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1869a6a83525ceda,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "OzJohn" <hstest1@nooo.spam.com> Sender: "OzJohn" <hstest1@nooo.spam.com> Reply-To: "OzJohn" <hstest1@nooo.spam.com> Subject: Win API to peek next tcp local port Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 203.47.243.226 NNTP-Posting-Host: 207.105.83.66 Message-ID: <40ecd826$1@newsgroups.borland.com> Date: 7 Jul 2004 22:14:14 -0700 X-Trace: newsgroups.borland.com 1089263654 207.105.83.66 (7 Jul 2004 22:14:14 -0700) Lines: 12 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail