473,698 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IO Serial COM Exception

Hi All,

I write a dll use vb.net 2005 to read data from a serial port and use this
dll in a C# 2005 application. It works well except when I close the port.
After I close the port, sometimes the dll stopped at the readline statement
in data_received function. But the port closed already, why this function is
still fired? ( is it because the delay message? I guess ) I catch the
exception and try to throw a excption, but the dll stopped at the throw
exception statement. This problem is not always there, but sometimes, lets
say 1 of 5. The error message in debug mode is "System.IO.IOEx ception was
unhandled".

Your help are always appreciated
Feb 5 '07 #1
3 2029
Hi,

This (probably) is a problem in the device driver handling the serial port.
I say this because I have seen it with USB serial devices, but not with
internal ports that use physical UARTs instead of the virtual UART that is
furnished by a USB adapter.

You can download DesktopSerialIO .dll for VS2005 from my homepage. I have
tested it with several USB devices, and it (so far) does not have this
problem. Let me know if it works for you. The API that it provides is
similar the SerialPort, but not exactly the same, so you will have to do a
small amount of "porting."

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
Feb 5 '07 #2
Thank you, Richard

Sorry for the late reply.
I'm trying to use your dll; one question, how the CommPort (an Integer)
relate to Serial Port ( a string, COM1, COM2...)?

Rgds,

Taoge
"Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
news:uc******** *****@TK2MSFTNG P02.phx.gbl...
Hi,

This (probably) is a problem in the device driver handling the serial
port. I say this because I have seen it with USB serial devices, but not
with internal ports that use physical UARTs instead of the virtual UART
that is furnished by a USB adapter.

You can download DesktopSerialIO .dll for VS2005 from my homepage. I have
tested it with several USB devices, and it (so far) does not have this
problem. Let me know if it works for you. The API that it provides is
similar the SerialPort, but not exactly the same, so you will have to do a
small amount of "porting."

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.

Feb 10 '07 #3
Hi Richard,

Is the InputString same as ReadLine?
If set the PortOpen property to false, is the Port closed and released? Or
should I use dispose to release the port?

Thanks
"Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
news:uc******** *****@TK2MSFTNG P02.phx.gbl...
Hi,

This (probably) is a problem in the device driver handling the serial
port. I say this because I have seen it with USB serial devices, but not
with internal ports that use physical UARTs instead of the virtual UART
that is furnished by a USB adapter.

You can download DesktopSerialIO .dll for VS2005 from my homepage. I have
tested it with several USB devices, and it (so far) does not have this
problem. Let me know if it works for you. The API that it provides is
similar the SerialPort, but not exactly the same, so you will have to do a
small amount of "porting."

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.

Feb 10 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5441
by: mimisam | last post by:
hi, I am using Win XP and writing an application to check POS devices (printer and cash drawer).In the application I need to choose the port which the device is connected to. If the port chosen is wrong or the device is off power, a communication error message should be displayed. I am using FileOutputStream and FileInputStream to send and receive data from the ports. When parallel port is used, I got the feedback when the printer is...
0
2481
by: David | last post by:
I am having trouble with "ACCESS DENIED" error messages in a VB.NET 2003 application when attempting to open serial comms ports. The application has 2 ports that connect via serial cable to 2 different hardware devices to transfer binary data to the application. The setup screen enables the user to select COM1 -- COM8 via combo boax for each port. Then they click "Apply" to open the ports. The code that I have written to open the...
4
11048
by: Lonifasiko | last post by:
Hi, I've been able to communicate using HyperTerminal with my device via serial port COM1. I just send a command and device switches on. I just need that to start playing with it. This way, I understand device and serial communication work wihout problems. Now I want to do the same with C# code. As simple as that. I open the serial port with the configuration manufacturer gives me,
5
9491
by: LongBow | last post by:
Hello, Is there a way, in .NET, to determine what are the avialable Serial (Communications) Ports on a Windows OS and is there a way to determine that port isn't being use other than attempting to opening the Serial Port and catching the associated exception? Thanks If there isn't a way to determine the Serial Port within .NET I would be willing, I guess, to use a WinAPI is that was the only way.
2
3955
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the development computer I don't have ay problem with my application.
2
2427
by: Japan Shah | last post by:
Hello, I am trying to connect my Nokia 6610 using usb cable, I have installed usb-serial driver of it. I hv tested it with Hyperterminal and it works fine. but when I wrote a python script I am not able to receive the responce from the device.
4
5441
by: cmdolcet69 | last post by:
This code below write a serial command to the com port then read the results and disaplays it into the label1.text property when button1_click event is triggered. I think what is going on is that the ocp.read is on a timer and reads char by char. How can i change this code so that the read reads the whole result and not char by char? Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
0
4558
by: ghjk | last post by:
I want to read sms from GSM modem using C# in serial communication. I wrote the code. But i want to do it automatically. I put my code here and please tell me how can i do it automatically. public partial class SMS : Form { //create an Serial Port object SerialPort sp = new SerialPort(); public SMS() {
6
6661
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send '%' to serial port and make sure it reached the serial port. 2. Once confirmed, send another character.
2
3152
by: Bassem | last post by:
I'm working on simple chat program via serial port. It works fine, but i face this problem. When i try to open the exe, UnauthorizedAccess exception occurs, i can't use COM1 becuase someone else has it. I checked it and found that another copy of the program still work (by task manager). That's mean closing the program will not close the serial port. I tried these : Note: I read it using a separate thread. 1)override OnClose to, close the...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9155
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2322
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.