[Win32utils-devel] Fw: Win32 OVERLAPPING IO

Daniel Berger djberg96 at yahoo.com
Thu Oct 19 19:42:47 EDT 2006


Suggestions?

----- Forwarded Message ----
From: James Tucker <jt at ra66i.co.uk>
To: djberg96 at yahoo.com
Sent: Thursday, October 19, 2006 7:28:30 AM
Subject: Win32 OVERLAPPING IO

Hi Daniel,

    My name is James Tucker, I've been hacking in Ruby for only a few 
months now, however am an experienced general programmer in a wide 
variety of languages. My current focus is on a new development project 
involving an RS232 data protocol handler, which up until now I have 
programmed in ruby.

    We have a small problem with the ruby platform for this issue however, 
and it is related to several factors:

  - Ruby threads are green threads, IO blocks block all threads.
  - RS232 Comms on Windows using the Windows::File#open don't provide 
non overlapping I/O.
  - There is little easy to introduce documentation on how to use 
Windows::File#ReadFileEx in ruby.

    Ruby does however provide us with some major advantages. I programmed 
the stateful parser and threading system in under a day, and to date it 
serves perfectly as a one-way reader. Today however, we need to change 
this to continue this project.

    Besides my own testing code, I have been reading as much as possible 
around the topic, and one such thing which has really raised an eyebrow 
is this: http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/

    In particular the following statement:
"Out-of-the-box, the only way of coding RS232 serial communications 
applications in the .NET environment is to import the outdated and 
somewhat limited MSComm ActiveX control. This article describes the 
development of a lean, multithreaded, and modern RS232 base class 
library in C# managed code. The library uses Platform Invocation 
Services to interact with the Win32 API directly. Application 
programmers can use the library from any .NET language through 
inheritance; the article explores examples written in C# and Visual 
Basic .NET."

    This would suggest that the only clean way to access RS232 non-blocking 
I/O in Windows is through this COM/Win32 API. I'm interested to know if:

  - The non-overlapping mode of Windows::File#ReadFileEx can achieve the 
same goal (if so, I would love to have some guidance on this, and in 
return I'll produce some clean documentation for you to add to the src).
  - If not, is there a way to hook the Win32 API using your code, in 
order to achieve the same goal?

    One final question, which I could not see a clear answer to reading on 
rubyforge, does upgrading the windows-pr gem upgrade all of the Windows 
namespace? I had some problems with Daemon a while back and am wondering 
if a fresh upgrade of windows-pr will solve this issue?

Many thanks for any time you can spare me,

James Tucker.

P.S. If you are able to get onto freenode, I'm 'raggi'.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3573 bytes
Desc: S/MIME Cryptographic Signature
Url : http://rubyforge.org/pipermail/win32utils-devel/attachments/20061019/dfe2fa07/attachment.bin 


More information about the win32utils-devel mailing list