![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | asynchronous serial i/o Hi, I am trying to perform asynchronous serial (RS232 port) I/O in C# in a "proper" manner. I noticed there is an event that will tell me when there is something on the port, but I can't find a similar construct for writing to the port. Although the documenation states that SerialPort.Write() and SerialPort.WriteLine() write to the buffer, they do not return until all bytes have been actually transmitted (I tested this by sending 1K @ 1200bps). I was hoping for some way to send something to the driver, and be notified when it was transmitted on the port. Something like what would happen by specifying FILE_FLAG_OVERLAPPED to the native Win32 CreateFile() call. My options: 1) Create my own thread(s) to do the asynchronous reading and writing (seems a bit expensive) 2) Use P/Invoke on CreateFile and whatever I need to write to it (not really something I prefer) 3) I have missed something, and there is a "better way" Any pointers would be greatly appreciated! Thanks for the help, -- Martijn |
My System Specs![]() |
| | #2 (permalink) |
| | Re: asynchronous serial i/o Martijn wrote: Quote: > I am trying to perform asynchronous serial (RS232 port) I/O in C# in a > "proper" manner. I noticed there is an event that will tell me when there > is something on the port, but I can't find a similar construct for writing > to the port. > -- J. http://symbolsprose.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: asynchronous serial i/o Jeroen Mostert wrote: Quote: > Martijn wrote: Quote: >> I am trying to perform asynchronous serial (RS232 port) I/O in C# in >> a "proper" manner. I noticed there is an event that will tell me >> when there is something on the port, but I can't find a similar >> construct for writing to the port. >> Thanks for pointing this out, exactly what I was looking for. I knew SerialPort used some kind of stream, and when browsing the documentation I overlooked that property and it being so obvious to get at :S Thanks a million, -- Martijn http://www.sereneconcepts.nl http://blogger.xs4all.nl/mihaak/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Asynchronous Processing | PowerShell | |||
| Re: Serial Plonkers v. Serial Killers | Vista General | |||
| new process should be asynchronous | .NET General | |||
| Serial ATA AN (Asynchronous Notification) | Vista hardware & devices | |||