serial-port

C# SerialPort - emulate pos keyboard

We are trying to emulate a POS keyboard in order to integrate an application with an existing Point of Sale application. We ran across this software: Virtual Serial Port Kit It basically creates a virtual serial port pair so that data send to COM1 can come out of COM4 and vice versa. This allows our application to send data through CO...

Closing and immediately re-opening a COM port fails: Why?

I'm trying to do 'pre-flight checks' by testing a COM port's 'openability' before launching a dialog window which allows the user to do com-porty things. Here's the code sequence, in outline: handle = CreateFile("\\\\.\\COM4:", GENERIC_READ | GENERIC_WRITE, 0,NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,NULL); if (handle != INVALID_HANDL...

A look into serialPort

You wrote at: Opened SerialPort crashes C# application "A look into the .NET Framework source code helped a lot. But I think the thrown ObjectDisposedException should be caught by the SerialPort, not by the user." I'd like to take a look on source code for serialPort. How can I do it? ...

C# serialPort speed

Hi I am developing some monitoring tool for some kind of protocol based on serial communication. Serial BaudRate=187,5kb I use System.IO.Ports.SerialPort class. This protocol has 4 kinds of frames. They have 1Byte,3Bytes,6Bytes, 10-255Bytes. I can work with them but I receive them too late to respond. For the beginning I receive firs...

Serial port and handling errors during overlapped I/O operations

I've been doing serial communications lately so I prepared a class being a simple interface to all those Windows API functions responsible for reading, writing, etc. All I/O operations inside this class are handled asynchronously. Before I go to my question, let me show you how I write and read data from serial port (this is only the re...

"Safe handle has been closed" with SerialPort and a thread in C#

Good afternoon everybody! I have this threaded SerialPort wrapper that reads in a line from the serial port. Here is my thread's code. protected void ReadData() { SerialPort serialPort = null; try { serialPort = SetupSerialPort(_serialPortSettings); serialPort.Open(); string data; whi...

Comprehesive information on serial ports and programming?

What are some comprehesive sources on serial programming? Ideally they would cover things like: history of devices current and future uses how serial devices work protocols and, of course, how to program, preferably in C/C++ ...

C# communicate with RS-232 using VISA

Hi, Does anyone have any C# example code to communicate with a device thru an RS-232 serial port using VISA ? I just want to issuse some simple commands and queries to the device as well as open and close it, of course. Any help or advice would be most appreciated. Regards, George. ...

sysinternals portmon: error 2

I'm getting the error message: "error 2" when I try to connect to local ports Computer -> Connect local using portmon.exe v. 3.02 I run the tool as an administrator (if not, I get error 6). By the way this is a Windows 7 x64, in Windows 7 x86 it works fine. Any ideas? ...

bluetooth serial device detect COM port #

I am pairing to or connecting to a Bluetooth device that has a serial port service associated with it. Is is possible to determine the COM port it registers too? If so, how? ...

Implementing a timeout on a function returning a value

I have a function that calls out a read or write request on a serial port and then returns the value that was read. I am using Commstudio express (I'm implementing a class from Commstudio) , but it's timeout features don't appear to work at all, so I'm trying to implement my own timeout. Currently I have a timer that is set upon request ...

C# - Emulate device - Parallel to Serial Port

We are trying to emulate a device that runs off a parallel port. We have the exact same model that runs on RS232, and can run a null modem cable from one port to another and emulate the device with the following settings: _port = new SerialPort { PortName = comport, BaudRate = 960...

Serial port communications in C#

We have a scenario where multiple devices are connected to one com port. Each device has an access code, which is manually defined within the device. Can I access all the connected devices with/by access code in C#?. Does anybody have any idea as to how to do this? In my case multiple devices are connected with single port but slave ad...

How do I get a list of available serial ports in Win32?

I have some legacy code that provides a list of the available COM ports on the PC by calling the EnumPorts() function and then filtering for the port names that start with "COM". For testing purposes it would be very useful if I could use this code with something like com0com, which provides pairs of virtual COM ports looped together as...

Problem receving in RXTX

I've been using RXTX for about a year now, without too many problems. I just started a new program to interact with a new piece of hardware, so I reused the connect() method I've used on my other projects, but I have a weird problem I've never seen before. The Problem The device works fine, because when I connect with hyperterminal, I...

Is constant polling in RXTX necessary?

While trying to figure out this problem (any help there is appreciated), I ran RXTX while monitoring its activity using PortMon and noticed that RXTX constantly checks if data is available, even when the Java client reads from the gnu.io.SerialPort object only through a SerialPortEventListener. Why is this? Is it a poor implementation ...

SerialPort reading cause error because of not owning thread

I have a simple WPF windows application trying to read a serial port with the System.IO.Ports.SerialPort. When I try to read the incoming data in the DataReceived event, I get an exception saying that I don't have access to the thread. How do I solve it? I have this in the WPF window class: Public WithEvents mSerialPort As New Seri...

Looking to build a WPF XBap with full trust, can a purchased certificate get past some of the security issues?

We are developing an application that needs to talk to some hardware (serial port) on the machine, and most of what we do is WPF and .net, so an xbap seems logical. My concern is with the certifcates. I have seen a bunch of people showing how to create and self sign applications, but then the user is required to install that to their m...

Writing to a Serial (Com) Port in Visual C++

I have a device that is connected on port COM4, (115200 baud, 8-N-1). Based on examples I found here I'm opening the port with: Keyboard_Handle=CreateFile("\\\\.\\COM4",GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,NULL); if(GetLastError() !=0 || Keyboard_Handle == INVALID_HANDLE_VALU...

Tcl Serial Port fconfigure portability issue

Hi all, I've got a Tcl/Expect program that reads and writes data to the serial port. I did all of my development and testing on a Fedora 7 machine, but I'm now trying to run the same code in Ubuntu 8.10, and I'm getting the following error: spawn: returns {0} bad option "-mode": should be one of -blocking, -buffering, -buffersize, -enc...