Skip to main content

IOException: Opening port COM7 was failed.

2 replies [Last post]
dmantamp
Offline
Joined: 2006-11-01
Points: 0

Hi All,
I am using Phone MeFeatue on my windows mobile device. I was trying open a Serial port. But it fails with error

IOException: Opening port COM7 was failed.

COM7 is my GPS port from where the application should read the contents. All other native applications work fine with the same port using same baudrate. If I change port to anything else, i could open the port, but does not read any data.

This issue happens even with Windows Mobile 6.0 emulator.

Any help ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dmantamp
Offline
Joined: 2006-11-01
Points: 0

I saw the following piece of code. Is the cause for the error...

In function wincomm_serial_open()

fd = CreateFile(lpFileName,
GENERIC_READ | GENERIC_WRITE,
..................

We are opening the port in READ WRITE mode even though I specify as read only.I could not compile the code and test as I do not have Visual Studio installed.

dmantamp
Offline
Joined: 2006-11-01
Points: 0

BTW, I am using

_mComPort="com7";
String params=";baudrate=4800";
(CommConnection) Connector.open("comm:" + _mComPort+params,Connector.READ);