Serial I/O and Timeouts

Serial I/O and Timeouts

Community Admin's picture

I'm looking at porting an OPEN VMS FORTRAN application that drives devices on serial asynchronous lines. It uses VAX System I/O calls to drive the serial ports. I need to port the application to run on UNIX, Windows NT and Windows 2000. I'm hoping to be able to come up with a single version of the code to run on all platforms using standard FORTRAN I/O call likes OPEN, READ, WRITE, CLOSE. At the same time, the application must provide device timeout capability where a device on a serial line does not respond in a timely fashion and where fault recovery processes can be intiated.

The benchmarks I've run so far indicate that I can achieve at least part of the task using standard FORTRAN I/O, i.e., STREAM_LF, etc. I unfortunately find that the behavior of the READ calls is inconsistent on the different platforms when the device does not respond; Windows 2000 suspends the task, UNIX returns immediately with a zero byte read indication, sometimes Windows NT behaves like UNIX. That's the first problem. The other problem is when the task is supended in Windows 2000, the task appears to be blockes such that it does not service the independent timeout signal that it is sent.

I'm looking for suggestions to help me overcome the two problems mentioned.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
james@elementyl.com's picture

Unless you have a particularly simple job to do, the Fortran RTL isn't going to be your answer. You didn't mention if the code still has to run on OpenVMS, however to have decent control over serial port communications you are either going to need to use the DFLIB SPORT_* routines or use the OS routines directly and do conditional compilation.


James

Login to leave a comment.