.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Serial Port with portable data terminal

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :ASP.Net
Hi,I am making application with portable data terminal which connected to serial port. User will go with portable data terminal and scan data with it than we will connect it to PC and read all the data from it. Kindly somebody help me how to do that.Thanx

View Complete Post

More Related Resource Links

.NET Serial/COM Port Communication over Terminal Services



I hope I'll be able to clearly formulate my question.

Scenario: we have an application that integrates with several type of scanners (i.e. credit card, barcode, passport) using serial port interface.
It's the desktop application and can be deployed to run either in stand-alone environment or can be published over terminal services layer (citrix, TS, etc).
In the preferences of the application users are able to specify which scanner is assigned to which COM port.
For example: bar code scanner = COM1, credit card scanner = COM5.
To a user, names of the COM ports don't really make much sense and they won't know that the bar code scanner needs to be assigned to COM1 unless they go to Device Manager and look up the device name associated with the COM port under Ports (COM & LPT) section.

SerialPort class in .NET Framework has the function GetPortNames that returns the list of available COM ports: COM1, COM3, COM5, COM6, etc.
After doing a little research I found a way to get the descriptive names of each COM port device using WMI.

Here is the code for this:

  Public Shared Function GetAvailableSerialPorts(

bluetooth print via serial port PDA

Print via BlueTooth using PDA

Serial Port Communication Read and Write using C#.net

In this simple article you will learn that how you can Open and read COM port data using System.IO.Ports Namespace.
Simply just create New Project of windows application in C#.

Import ServiceProcess APIs
using System.IO.Ports

Imports System.IO.Ports

Write Parsing functions which parse port data according to attached device

How to wait for a Serial Port to respond

Hi Is it to possible to wait for a serialPort component to complete it's response?  I have a device connected to the serial port of my PC. I use the serialPort component in order to communicate with the device. I have to send 2 different strings of data to the serial port but the trick is that after sending the first string of data I have to wait for the serial port to respond. Then I have to check the response and decide whether I must send the second string or not. Also after sending the second string, I have to check also the response of the serial port. I tried to use an arbitrary amount of wait time between the sending of the two strings. Something like SerialPort.Write(...) ; Thread.Sleep(2000); SerialPort.Write(...); But the software failed when I tried it in a slower PC. So is there a way to replace the Thread.Sleep(2000) with a command that will wait until the serial port complete its response? Although, the response of the serial port is different between the two sending strings, I do know that the first response is only one byte and I know the ending byte of the second response. Also, the second response is no more than 30 bytes in length. Regards Dimitris

DataReceived event not triggered in vb.Net until serial port is closed & opened again

I am developing an application which sends multiple AT commands to a modem in VB.Net. After writing an AT command to the modem, I see the dataReceived event is not getting triggered until I close the port & open it again & write the next AT command. This behavior is consistent. As soon as I write the next AT command the response of previous AT command is read. Even adding a delay between the two write operations does not work. I also added a readData between the two writes so that data is read if it exist in buffer or stream but is not triggering datareceived event because bytestoread is non-zero, but that does not hep too. Because of insufficient read operations the data in readbuffer grows(accumulating) & after sometime the modem stops receiving the AT commands. Please suggest a solution code for data received handler & read data function   While comPort.BytesToRead > 0     Dim msgCharArray(255) As Char       If comPort.BytesToRead >= 256 Then     comPort.Read(msgCharArray, 0, 256)   Else    comPort.Read(msgCharArray, 0, comPort.BytesToRead)   End If   End While

Serial Port Conflict

Hi.... I have an issue related to serial port opening. when i run my software it gives me an error "serial port does not exit or already opened". I have two questions. 1.can i check which program is using com port. And how can i close serial port that is already being used.Using Windows7  

Getting the name of the process that is using a serial port or file


Sometimes it happens that opening one file or serial port fails because it is used by another process.

Is there a way to get the name of the process that is using it ? 

Thank you

Serial Port plug/unplug detection with callback


Is there a way to register a callback or delegate that gets invoked by the system every time a new virtual COM port is connected to a USB interface ?

This function would be very useful to keep serial port enumeration up to date without polling.

Thank you

Serial Port Application Leaks Handle After Exit Forcing Reboot to Clear


The application (C# .Net 3.5) available at www.redondowa.com/porttest demonstrates a problem encountered with a Sony VAIO multimedia laptop related to use of its serial modem port.  A discussion with MS support is included in a doc with the VS solution.

If the base stream or port is not closed before nulling the port, the port cannot be recreated and the application leaves the port inaccessible.  The machine requires a reboot to clear the error.  Other machines clear the error without requiring a reboot.

<!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:"Arial Unicode MS"; mso-font-charset:134; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"\@SimSun"; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-charset:134; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch

USB Serial Port, baude rate limited by Overrun errors



I need to dump a huge number of characters per second to a PC from a simple micro controlled device rs232 port at the least for debugging purposes.

I can select and sucesfully transmit/receive at speeds up to 3M baud without significant data coruption on short packets, however for sustained data I get too many overrun errors for it to be usefull, even at 230K buad it is too much.

I am using a usb serial cable, on windows 7 (64) on an I7 system, so it should have plenty of cpu power to keep up. it only needs to service it twice per millisecond at 230kBaud to keep up.

I am programming with C# and have 3 threads, one for the UI, one for the port, and one for decoding the data.

I have a large data buffer, and I am calling read fast enough so that I get about 100 characters on average, the SerialPort object port buffer is set to "very big" (64k), with byte threshold set to 100, setting it to 1 makes no difference.

The 16 byte Fifo on the usb serial cable is set to 1, but this makes little diference.

From what I have read it is the device driver not reading the usb port fast enough, and the usb serial cable "chip" runs out of buffer.

I have tried different usb serial cables, but they have the same 16 byte buffer and the same problem.

Is there any way I can speed this up ? I would of th

read data from usb port

I need a C# code for reading data from usb port

Serial port



I'm try to read a RFID tag ID with a RFID reader.

I want to see ID tag in a text box.

1-Reader, once every 1 second read tag, Therefore I want to see ID tag in a text box Continuous.

2-Reader send a hex/string code to serial port such as    (␠b%) , however I should see  E2 00 90 20 14 19 01 62 25 00 18 1F

would you please help me ; how I can develop a C# code in windows application?

How improve the serial port reception and analisys?


Hello everyone

I'm building a system that communicates with multiple sensors with RS-232 serial interface. I build "user controls" for each sensor which is responsible for displaying the information received by the serial port, and each control has its own serial and works independent of the main application.

the problem is my app is not fast enough to clean the serial buffer and my analysis function cannot finish, making the serial buffer grows continuously. This function is called inside the serial event handling. (I read in an article that processing should be make in other threads and never in event handlers)

I thought to use a BeginInvoke delegate() to do this analysis, but I would like to know if there are no other possibilities.

another problem can be the draw function that I use to draw the signal (like a ECG), maybe my draw box is not fast enough and it is creating a lag between the serial reception and the drawing.


private void SpO2_SerialPort_DataReceived (object sender, System.IO SerialDataReceivedEventArgs method and)


  if (SpO2_SerialPort. BytesToRead > 72)


    SpO2_SerialPort INFs.read (SerialBuffer, 0, 72);

     for (int I = 0; I < SerialBuffer. Length; I ++)



How fast can you change baud rate on a serial port.


Hello to anybody,

I've got a piece of hardware I wan't to communicate with over a serial port and I'm wanting to change baud rate on a serial port within 10 ms.  I close the port, change baud rate and then open the port agian, but this doesn't seem to work to well.  How can I really tell if the serial port has made the change, how long is this likely to take? Is changing the baud rate in 10 ms impossible?

Any answers would be appreisated, thanks.

serial port asp.net

i would like to do an web application that can initializa a communication with serial port..
what should i do to make an activex for this purpose?
where do i start? c++, mfc,atl, ....
what ever..
my customer should connect to their devices which located connected to their desktops using my web application..
please help

Serial port



I installed Visual Basic express 2010 ; I am a newbee in programming but an old Ham radio operator. I am interested in writing a program for controlling my transceiver (frequency, VFO, memory) by issuing commands via the com port.

I copied a routine proposed by Wei-Meng Lee - Programming Serial Ports Using Visual Basic 2005 found on devx.com. I compiled it and ran it but I did not succed because it does not correspond exactly to my needs and I am unable to modify it. I know that I have a lot to learn.

I want to :

display all comports, possible data bits, stop bits, etc

choose a comport and its parameters and connect to this port.

Send the commands for this rig. Example : for changing frequency of VFO A to 14250000, I must send "FA14250000;"

For reading value of VFO B "FB;"

Maybe there are Hams reading this forum. Can someone put me on the right track ? When that works, I'll go further.

Many thanks


.NET bug or my fault?: Serial port fail to open from C# because spoolsv.exe and my application try t

Dear all,
after browsing around I could not find any answer to my issue.

I'm writing a program in C# to access a serial device. The serial device comes with a legacy DLL probably written in C++ that provides an OpenDevice (which I call via DLLImport). The device is connected to a USB port via a Prolific USB to serial converter.
My problem is that 1 out of 5 times, the OpenDevice fails when I run my application. I have workaround to call it until it succeeds and it never goes beyond 3 or 4 tries.
By monitoring the serial port with Portmon I noticed that:
1) when running the application in debug mode from Visual studio the Com port is open from my process (MyApplication.EXE)
2) when running from windows the Com port communication belongs to windows print spooler service (spoolsv.exe) but Portmon also tracks an open command from MyApplication.EXE and here the collision happens: I'm suprised to see that the main communication from MyApplication is managed by spoolsv.exe so it is not just spoolsv.exe running in the background: I'm calling it!
3) the demo software from the supplier uses the same DLL but it is written in C++ and when I run it, spoolsv.exe does not show up (and open port never fails!)

I do not understand what is the trigger that makes the calls going through spoolsv.exe or directly to the port and
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend