but, if I restart my 4GLTE device(not disconnect, only press restart button, this COM will disappear in Device Manager), it will show an error message: The Requested Resource is in Use, and not disappear in serial port list.
when my device is restart ok, it will still report this error, until I close my program and rerun.
this bug is also in .net framework, same code.(I tried to report this, but nobody reply me)
port open: False
port open: False
scan port COM3
scan port COM4
scan port COM5
port open: True
port open: True
port open: True
port open: False
scan port COM3
error: System.IO.IOException: 请求的资源在使用中。
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at sp.Program.Main(String[] args) in C:\Users\chenx\Desktop\sp\sp\Program.cs:line 24
port open: False
scan port COM3
error: System.IO.IOException: 请求的资源在使用中。
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at sp.Program.Main(String[] args) in C:\Users\chenx\Desktop\sp\sp\Program.cs:line 24
************some same logs**************
port open: False
scan port COM3
error: System.IO.IOException: 请求的资源在使用中。
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at sp.Program.Main(String[] args) in C:\Users\chenx\Desktop\sp\sp\Program.cs:line 24
************* device restart complete here **************
port open: False
scan port COM3
error: System.IO.IOException: 请求的资源在使用中。
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at sp.Program.Main(String[] args) in C:\Users\chenx\Desktop\sp\sp\Program.cs:line 24
scan port COM4
scan port COM5
port open: False
scan port COM3
error: System.IO.IOException: 请求的资源在使用中。
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at sp.Program.Main(String[] args) in C:\Users\chenx\Desktop\sp\sp\Program.cs:line 24
scan port COM4
scan port COM5
port open: False
scan port COM3
error: System.IO.IOException: 请求的资源在使用中。
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at sp.Program.Main(String[] args) in C:\Users\chenx\Desktop\sp\sp\Program.cs:line 24
scan port COM4
scan port COM5
************same logs forever**************
I use this code:
I run this code, connect my 4GLTE device and srart it, the code connect success
but, if I restart my 4GLTE device(not disconnect, only press restart button, this COM will disappear in Device Manager), it will show an error message: The Requested Resource is in Use, and not disappear in serial port list.
when my device is restart ok, it will still report this error, until I close my program and rerun.
this bug is also in .net framework, same code.(I tried to report this, but nobody reply me)
code logs:
more infomation:
is this my wrong usage?