Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Subject: problem with reading off windows serial port To: cygwin AT cygwin DOT com X-Mailer: Lotus Notes Release 5.0 (Intl) 30 March 1999 Message-ID: From: nzissopo AT csc DOT com DOT au Date: Thu, 3 Jan 2002 10:40:19 +1030 X-MIMETrack: Serialize by Router on AUS-SYD11/AUST/CSC(Release 5.0.4a |July 24, 2000) at 03-01-2002 11:11:02 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Hi, I have a query in regards to reading data off the serial port on a Windows 98 machine with cygwin. The scenario is as follows: I have a test program that opens a file descriptor (fd) on com1 via: fd = open("com1", O_BINARY); The port opens successfully. Now there is a hardware device attached to com1 that sends 1 byte of data at a time. The test program attemps to read the data from the serial port via: no_of_bytes_received = read(fd, buffer, 1); if (no_of_bytes_received == -1) { cerr << "Read failed" << endl; } else { cerr << "Read succeeded" << endl; } However, the read() call never completes, ie. in this case the if statement is never executed. Now I understand that read() behaves differently in cygwin than it does in unix, as cygwin will block until the read completes. However, in this case because I am sending only 1 byte across the serial port, I would expect cygwin to read the one byte, and complete, and hence execute the above if statement. This does not occur. I may be overlooking something, but if anyone can lead me in the right direction, I would be greatful! Nick -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/