Article View: borland.public.cppbuilder.nativeapi
Article #8259Port Scans
From: Max Blank
Date: Mon, 08 Nov 2004 00:21
Date: Mon, 08 Nov 2004 00:21
20 lines
1849 bytes
1849 bytes
I need to automatically find a device connected to one of a computer's serial ports. This is no big deal: Simply create a file handle for each com port (using CreateFile), try to connect, pass the key phrase and wait for the correct response. Some systems, unfortunately, use USB<->Serial adapters that work with 19200 instead of 9600 baud. So I have to scan each port twice, don't I ? I first try to connect at 19200 baud and fail, because no device is attached to this port and no handle is being created. If I try to connect again at 9600 baud, CreateFile cannot create a handle; however, if I do not try to connect at 19200, or - even more strange - when I set a breakpoint, stop the program's execution for less than a second, and continue the program, the handle is being created and the port can be opened !!! So where's the problem ?? Max
Technical Details
Message-ID:
<418ebc0d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9fcab49b7cf126f6,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 08 Nov 2004 01:21:31 +0100 From: Max Blank <MaxBlank@MaxBlank-Institute.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Port Scans Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 217.186.46.45 Message-ID: <418ebc0d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099873293 217.186.46.45 (7 Nov 2004 16:21:33 -0700) Lines: 21 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail