🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4309

Re: open a port in Windows...

#4309
From: Malm32
Date: Thu, 09 Feb 2006 07:08
49 lines
3138 bytes
what i meant was if there is something like a priviledge as 
SE_SHUTDOWN_NAME that enables you to shutdown windows
but what i need is something different that will enable my program to be 
able to receive information on a single port that can be opened.
i know how to check if a port is already bound but what i need is to 
bypass the windows firewall prior to XPSP2 that asks the user to unblock 
the program. The versions before that do not ask at all. Is there any 
way to bypass it from code? Just like many other programs do it?
Apart from that i have seen that many programs detect even if there is a 
upnp firewall enabled and find that specific ports that either the user 
has opened manually or open some themselves!!! Do you know of any 
library that enables this feature?







Remy Lebeau (TeamB) wrote:
> "Malm32" <antreas7@bluebottle.com> wrote in message
> news:43e9f382$1@newsgroups.borland.com...
> 
>> Is there any way to open a port in windows
> 
> I assume that you are referring to a socket port?  If so, then simply create
> a new socket via the socket() function, bind it to a local IP/port via the
> bind() function, listen on it via the listen() function, and read from via
> the recv() function.  Refer to the Win32 API documentation for more details.
> 
>> or find out which ports are open.
> 
> The easiest way to do that is to loop through all possible port numbers
> (1-65535) attempting to bind to each one and see which ones succeed or fail.
> 
> Alternatively, there are OS hooks available that can retreive the
> information more accurately.  Refer to
> http://www.sysinternals.com/Utilities/TcpView.html for details.
> 
>> I want to know that so as to use my program as a server.
> 
> Just pick any port number and use it in your code.  Best would be if you let
> the user tell your program which port number to use dynamically.  If the
> socket fails when you try to open it, you can tell your user about it.
> 
> 
> Gambit
> 
> 
Technical Details
Message-ID: <43eae988$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!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: <43e9f382$1@newsgroups.borland.com> <43ea40cb$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2576a1d1dc3092
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 09 Feb 2006 09:08:22 +0200
From: Malm32 <antreas7@bluebottle.com>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: open a port in Windows...
References: <43e9f382$1@newsgroups.borland.com> <43ea40cb$1@newsgroups.borland.com>
In-Reply-To: <43ea40cb$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 87.202.45.201
Message-ID: <43eae988$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139468680 87.202.45.201 (8 Feb 2006 23:04:40 -0700)
Lines: 49
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!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