Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 4 Apr 2006 23:17:50 +0200,    group: microsoft.public.platformsdk.networking        back       


Check if a local port is bound   
Hi,

is there any way to check if a local UDP port is bound
other than actually trying to bind?

I read on MSDN that a port that has been bound is
not immediately available again for bindung after closesocket.

Unfortunately I can't do this in a single step (like try
to bind and leave it) but I need to test first, so what's
the best way to do that?

Thanks very much for any help,

Matthias Moetje
------------------------------------- 
TERASENS GmbH
Augustenstrae 24
80333 Munich, GERMANY
------------------------------------- 
Fon: +49 89 143370-0
Fax: +49 89 143370-22
e-mail: moetje at terasens dot com
www:   www.terasens.com
-------------------------------------
date: Tue, 4 Apr 2006 23:17:50 +0200   author:   Matthias Moetje [MVP]

Re: Check if a local port is bound   
You can check that with GetUdpStatistics(Ex)/GetTcpStatistics(Ex) from
IPHLPAPI.
Really by default the time socket still in is 240s
( look at documentation for 
HKEY_LOCAL_MACHINE\System\CurrectControlSet\services\Tcpip\Parameters\\TcpTimedWaitDelay), 
to overcome the problem sesockopt() with SO_REUSEADDR have to be used.
Arkady

"Matthias Moetje [MVP]"  wrote in message 
news:O4dK80CWGHA.5012@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> is there any way to check if a local UDP port is bound
> other than actually trying to bind?
>
> I read on MSDN that a port that has been bound is
> not immediately available again for bindung after closesocket.
>
> Unfortunately I can't do this in a single step (like try
> to bind and leave it) but I need to test first, so what's
> the best way to do that?
>
> Thanks very much for any help,
>
> Matthias Moetje
> ------------------------------------- 
> TERASENS GmbH
> Augustenstrae 24
> 80333 Munich, GERMANY
> ------------------------------------- 
> Fon: +49 89 143370-0
> Fax: +49 89 143370-22
> e-mail: moetje at terasens dot com
> www:   www.terasens.com
> ------------------------------------- 
>
>
date: Wed, 5 Apr 2006 12:31:19 +0200   author:   Arkady Frenkel

Re: Check if a local port is bound   
"Matthias Moetje [MVP]" wrote:

> is there any way to check if a local UDP port is bound
> other than actually trying to bind?

Have you tried getsockname()?

--gv
date: Wed, 5 Apr 2006 15:59:46 +0200   author:   Gisle Vanem

Re: Check if a local port is bound   
Hi,

"Matthias Moetje [MVP]"  wrote in message 
news:O4dK80CWGHA.5012@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> is there any way to check if a local UDP port is bound
> other than actually trying to bind?

I'm just curious ... why would you want to know if a port is bound or not 
other than to bind it?

regards,
Alexandru.

>
> I read on MSDN that a port that has been bound is
> not immediately available again for bindung after closesocket.
>
> Unfortunately I can't do this in a single step (like try
> to bind and leave it) but I need to test first, so what's
> the best way to do that?
>
> Thanks very much for any help,
>
> Matthias Moetje
> ------------------------------------- 
> TERASENS GmbH
> Augustenstrae 24
> 80333 Munich, GERMANY
> ------------------------------------- 
> Fon: +49 89 143370-0
> Fax: +49 89 143370-22
> e-mail: moetje at terasens dot com
> www:   www.terasens.com
> ------------------------------------- 
>
>
date: Thu, 6 Apr 2006 10:47:27 +0300   author:   andu

Re: Check if a local port is bound   
this post might be helpful to you
http://www.codeguru.com/forum/archive/index.php/t-188092.html
Enumerating TCP ports and mapping them to PID (for XP)
date: Fri, 7 Apr 2006 18:21:41 +0800   author:   www.fruitfruit.com

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us