SerialPort Component IOException issue

I have a Ipaq Pocket PC.  It connects to a bluetooth GPS Receiver (COM6).  Whenever I try to open this COM Port using the SerialPort component I get an IOException.  I have even tried listing all COM ports on the PPC, and opening each one inturn.  Some work and some throw an IOException.

Does anyone have a suggestion


Answer this question

SerialPort Component IOException issue

  • trehberg

    Hi carda,

    I will investigate the issue. To facilitate the investigation, can you let me know:

    - the stack trace when the IOException is thrown
    - the brand and model of the bluetooth GPS receiver you used
    - the brand and model of the bluetooth card/device
    - the OS of the device

    Thanks,
    Anthony Wong [MSFT]

  • Ickman

    Reproduced same problem with my HP Ipaq 3870 - if you catch the exception and ignore, all works fine

  • Jan V

    Hi carda,

    I was not able to reproduce the issue on a Toshiba e750 with a SocketCom Bluetooth Card, or the integrated Bluetooth on HP IPAQ 6515. The Bluetooth GPS device I used is GlobalSat Bluetooth GPS BT-338 that I think is similar to the one you used. SerialPort.Open() works fine on the outgoing Bluetooth virtual serial port connected to the Bluetooth GPS device, and I can read the data from the Bluetooth GPS device.

    I wonder if you could reproduce the issue on other devices as well

    Cheers,
    Anthony Wong [MSFT]

  • anandc

    No Problem,

    The stack trace is as follows:

    at System.IO.Ports.SerialStream.WinIOError()
    at System.IO.Ports.SerialStream.WinIOError()
    at System.IO.Ports.SerialStream.CheckResult()
    at System.IO.Ports.SerialStream.SetBufferSizes()
    at System.IO.Ports.SerialPort.Open()
    at TestThreadingPPC.SerialThreading.StartAsync()
    at TestThreadingPPC.frmMain.btnStart_Click()
    at System.Windows.Forms.Control.OnClick()
    at System.Windows.Forms.Button.OnClick()
    at System.Windows.Forms.ButtonBase.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.EVL.EnterMainLoop()
    at System.Windows.Forms.Application.Run()
    at TestThreadingPPC.frmMain.Main()

    The calls in bold are CF calls.

    Brand/Model of GPS Receiver: iPAQ Navigation System BT-308

    Bluetooth device: HP iPAQ H4150

    OS of Device: Windows CE 4.20

    Hope this helps


  • mabadica

    Hi carda,

    You will need to pair up with the bluetooth receiver before you use the serialport class. Are you able to use other programs to communicate with the receiver

    Cheers,
    Anthony Wong [MSFT]

  • JPB

    Hey Anthony,

    After posting the above yesterday I did some further testing.  I firstly tested the application with the device paired and connected (same result).  I also tried it paired and not connected etc and all was fine.

    I have tested successfully with a 3rd party component that reads from the serial port without problem.

    Also, late yesterday I worked out that even though the SerialPort component is throwing an IOException on Open(), it is still successfully opening the port.  I am able to read from the port!  But, the DataReceived event refuses to fire.......

    Hope this gives you some more background info...

    Cheers

  • Bobby Fu

    Thanks for the information. We will take a look at the issue.

    Cheers,

    Anthony Wong [MSFT]


  • MTM

    Same Exception here.
    I tried to Open a port on a hp ipaq hx4705 and it worked fine
    When i tried the same code on a HP ipaq h5500 it crashed with an IOExeption

    Have you guys have a solution for this problem


  • Rob C

    Hello, the same issue exists on my ipaq 1940. But after the exception is catched, the serial communications can be used - although i was not succesfull in using DataReceived event - it is never fired, so i had to use timer.

  • Grateful

    I have a iPaq hp 2200 (broadcomm/widcomm stack) and I'm using BTAccess to connect devices. I am trying to use System.IO.SerialPort for send data, but I am having problems to open bluetooth Com port, using the SerialPort component I get an IOException.
    At this forum you post:
    I was finally able to reproduce the issue on an IPAQ 4350 device. The issue seems to be specific to IPAQ 4150/4350 devices, and does not repro on devices like the IPAQ 6515. Nevertheless, we will consider taking a fix of the issue in the next service pack.
    Have you already fix this issue
    Thanks in advance
    Elsa


  • Glenn Slayden

    You were right, i was using CF2 without the service pack, but i've just installed th sp1 and the problem still holds.
    When i am trying to call the Open() method of a SerialPort object i get an IOException.

    the stack trace:

    at System.IO.Ports.SerialStream.WinIOError()
    at System.IO.Ports.SerialStream.WinIOError()
    at System.IO.Ports.SerialStream.CheckResult()
    at System.IO.Ports.SerialStream.SetBufferSizes()
    at System.IO.Ports.SerialPort.Open()
    at GPSMapMaker.Communicator.Open()
    at GPSMapMaker.MainForm..ctor()
    at GPSMapMaker.Program.Main()

    And this error doesn't occure in a hp ipaq hx4705, only in the hp ipaq h5500
    The port is a virtual port for a GlobalSat BT-338 gps reciever.




  • Mojtaba

    I think you will find that even though an IOExeption is raised, the serialPort is still open. put a try catch block around the open method, and do nothing. after opening the port, try reading/writing to it.

    Cheers


  • booga_boy

    Were you using NETCF V2 SP1 If not, I would suggest you to try the service pack. The service pack includes fixes for SerialPort which may resolve your issue.

    It would also be helpful to include a stack trace of the IOException for further investigation.

    Cheers,

    Anthony Wong [MSFT]


  • Jason Lodice

    Hi carda,

    I was finally able to reproduce the issue on an IPAQ 4350 device. The issue seems to be specific to IPAQ 4150/4350 devices, and does not repro on devices like the IPAQ 6515. Nevertheless, we will consider taking a fix of the issue in the next service pack.

    Thank you for reporting the issue!

    Cheers,
    Anthony Wong [MSFT]

  • SerialPort Component IOException issue