.NET Components for Mobility

BluetoothClient.GetStream() and ObexWebRequest(Uri, Stream) ctor - who closes the stream?

Last post 10-07-2008 2:05 PM by alanjmcf. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-02-2008 12:48 PM

    BluetoothClient.GetStream() and ObexWebRequest(Uri, Stream) ctor - who closes the stream?

    Hi,

    When using BluetoothClient.GetStream() and passing the stream into the ObexWebRequest(Uri, Stream) ctor who is responsbile for closing the stream?

    Is the stream closed by the ObexWebRequest instance as part of ObexWebRequest.GetResponse()?

    Thanks,

    -Mark

  • 10-03-2008 4:22 PM In reply to

    Re: BluetoothClient.GetStream() and ObexWebRequest(Uri, Stream) ctor - who closes the stream?

    Ahhh, I added that overload mainly for test purposes and hadn't really considered its use in production.  I'll have to double check but the ObexWebRequest/Response class should be responsible for closing it -- originally all the comms was via a NetworkStream from IrDAClient/BluetoothClient so the classes close that, and stream passed-in was just used like that, so it should be closed too. :-)

    Why do you need to open the stream externally BTW.  Are you connecting to a different OBEX target perhaps?

    Alan

    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.
  • 10-06-2008 9:16 AM In reply to

    Re: BluetoothClient.GetStream() and ObexWebRequest(Uri, Stream) ctor - who closes the stream?

    The main reason for doing so is to be able to enforce a connect timeout whilst still using the convenience of the ObexWebRequest / Response classes, which only support a publish timeout.

    I use BluetoothClient.BeginConnect() and then block the main thread with an asyncConnectResult.AsyncWaitHandle.WaitOne(someConnectTimeout). If the connection is successful then instantiate ObexWebRequest() supplying the stream returned from BluetoothClient.GetStream().

    So.....don't remove the overload as it's kinda useful Wink

    -Mark

  • 10-07-2008 2:05 PM In reply to

    Re: BluetoothClient.GetStream() and ObexWebRequest(Uri, Stream) ctor - who closes the stream?

    :-)  Yup no worries we'll leave it there.  We'll see whether an ConnectTimeout property could be added too...

    Alan

    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.
Page 1 of 1 (4 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.