.NET Components for Mobility

SerialPort open IoException

Last post 08-31-2008 8:50 PM by jacklu. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-29-2008 1:54 AM

    SerialPort open IoException

    my program :

      if (!serialPort1.IsOpen)
                    {
                        serialPort1.Open();
                    }
                    else
                    {
                        serialPort1.Close();
                        serialPort1.Open();
                    }

     serialPort1.WriteLine("///");

    when serialPort1.Open ,  catch the wrong message 'IoException' and the 'COM8' port does't exist

     But I am sure that 'COM8' is the bluetooth port ,  what's wrong ? who can help me out ?

    thank you very much 

  • 08-31-2008 9:32 AM In reply to

    Re: SerialPort open IoException

    As I noted in the other thread.  I recommend not using serial ports unless you *really* need too!  From the user's guide:

    By far the easiest and best way to use a serial port connection is to use BluetoothClient with service class BluetoothService.SerialPort, i.e. using code very much like shown above.  Both BluetoothClient and virtual serial ports use the RFCOMM protocol so the two are equivalent.  This method is much easier to set-up that a virtual serial port, there is no global state to configure etc; and is also more robust, for instance if the peer device is taken out of range or turned-off one learns this directly soon after, whereas with a serial port one has to use timeouts and retries to detect it.

    However there are cases where a virtual serial port is required, for instance where another program needs to access the connection — a common case is where your program is configuring a connection that will be used by a printer driver utility.  [...]

     

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
  • 08-31-2008 8:50 PM In reply to

    Re: SerialPort open IoException

    thank you very much for your help, I am thinking bout your suggestion

    Filed under:
Page 1 of 1 (3 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.