Discussion:
Serial port - busy and event when data sent/ready
(too old to reply)
Sonnich Jensen
2016-07-07 14:21:11 UTC
Permalink
Hi all

I have a some SW, which has worked for 6+ months, but now I sometimes get a

The requested resource is in use

on this line

MySerialPort.Write(buffer, 0, n);

At the state of SW the error it should not be busy, as it only started to communicate. The device should not send data at this moment.
My receiver part can also send data when started, but first it needs a setup message, then a "start process" message.
(the device will react to the setup message, I wait for that and only when "confirmed" I send the "start process")

MySerialPort.BytesToWrite does not seem to provide the values I need to know, as it returns simply 7.

I recall ports, which would fire an event when data was sent, and at that moment new date could be sent from a buffer.
I dont seem to have that option with the visual studio SerialPort.

Can anyone help in some way?

WBR
Sonnich
Sonnich Jensen
2016-07-12 14:23:45 UTC
Permalink
Post by Sonnich Jensen
Hi all
I have a some SW, which has worked for 6+ months, but now I sometimes get a
The requested resource is in use
on this line
MySerialPort.Write(buffer, 0, n);
At the state of SW the error it should not be busy, as it only started to communicate. The device should not send data at this moment.
My receiver part can also send data when started, but first it needs a setup message, then a "start process" message.
(the device will react to the setup message, I wait for that and only when "confirmed" I send the "start process")
MySerialPort.BytesToWrite does not seem to provide the values I need to know, as it returns simply 7.
I recall ports, which would fire an event when data was sent, and at that moment new date could be sent from a buffer.
I dont seem to have that option with the visual studio SerialPort.
Can anyone help in some way?
WBR
Sonnich
The error was absent for some time, just to return now, for some 4-5 times in a row, only to disappear again.
I manager to get some debug information during the fails, but nothing that could give me any information.
Continue reading on narkive:
Search results for 'Serial port - busy and event when data sent/ready' (Questions and Answers)
10
replies
What are TCP, UDP, Proxy, port, local host, ip address?
started 2006-11-26 20:22:29 UTC
computer networking
Loading...