Re: Quick and easy way to check a port



Derek Fountain wrote:
I'm starting up a child process which, after a delay of a few seconds, opens a port and waits for data on it. I want my main script - the parent - to pause until the child is ready. I don't have access to the source for the child, so I figured the best thing to do is wait until the port goes ready.

Only, I'm not sure how to do that. I could system() out to netstat on the Linux box I'm working on, but really need something more platform independent - it should work on any form of *NIX if possible. Oh, and I don't want to upset the child process, which is basically does: listen, accept data, close, done.

Is there some platform independent way of checking a port is open without actually trying to open it then closing it on success?

Why not try to connect to the port and retry after a suitable period?

--
Josef Möllers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett

.



Relevant Pages

  • Re: Quick and easy way to check a port
    ... opens a port and waits for data on it. ... I don't have access to the source for the child, so I figured the best thing to do is wait until the port goes ready. ... I could systemout to netstat on the Linux box I'm working on, but really need something more platform independent - it should work on any form of *NIX if possible. ...
    (comp.lang.perl.misc)
  • RE: redhat-list Digest, Vol 4, Issue 38
    ... Re: Iptables: port 22 open only for my IP ... Windows Services for Unix 3.5 ... It does absolutely nothing if you have a rampant application on your Windows box that opens a port to the outside world. ...
    (RedHat)
  • Re: Enabling telnet, ftp, pop3 for root...
    ... MASIVE security improvement over just having an open port sitting there. ... only OPENS THE PORT! ... While I could be wrong on that, it's the most likely scenerio with three possible levels of security: low, if you're only using a password, mediocre if you're using a key protected by a password, and relatively high if you're using a key that you are protecting with a complex passphrase and swapping out routinely. ... Point being, when there are already such networks on the Internet -- and not just in the United States -- with a wide range of ISPs, it's not at all outside the realm of possibility that somebody has a box that is listening to all the traffic on your node and analyzing it. ...
    (alt.os.linux)
  • Re: USB device detection via query registry information
    ... Similarly vendors need to be given a hard time if they fail to provide a driver compatible with a new Windows version for products released in the last 3 years or offered for sale in the last 12 months. ... it correctly enforces exclusivity to the port ... serenum and sermouse are out-of-the-box XP as far as I can ... serenum opens the port, detects the device, ...
    (microsoft.public.development.device.drivers)
  • Re: OT: Trend Micro WFBS beta starting soon
    ... Trend firewall, even set to High, has inbound NetBIOS ports open. ... default 3389 port, web browsing, email, etc. ... it opens inbound NetBIOS connections until the laptop is rebooted. ...
    (microsoft.public.windows.server.sbs)