.NET Components for Mobility

Problems on sending file to device !

Last post 12-10-2007 12:51 PM by Oliver. 18 replies.
Page 1 of 2 (19 items) 1 2 Next >
Sort Posts: Previous Next
  • 11-21-2007 6:38 AM

    Problems on sending file to device !

    Hello!
    
    I'm trying to develop an application with bluetooth support but i have some 
    problems on transfer of files from desktop to PC.
    Currently i'm working with an Windows CE 5.0 device with bluetooth support.
    The upper stack is Microsoft native. As i read on some posts, since the device works 
    on Windows CE pltaform, i dont have access to radio functions (On, Off) due 
    to the missing file bthutil.dll. Luckly, the device (an Unitech HT660 provided by Unitech) 
    has couple of APIs for starting, stopping and getting state of bluetooth module.
    What i want to do is: step one: send a file from desktop to PC and second 
    step send a file back from device to desktop.
    
    In order to accomplish the first step, i take the following steps:
    
          /*//////////////////////// inquiring /////////////////////*/
     
         BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
         BluetoothClient   bc = new BluetoothClient();
         BluetoothDeviceInfo[]  bdi = bc.DiscoverDevices(12);
         BluetoothDeviceInfo dev;
         if ((bdi == null) || (bdi.Length == 0))
         {
                 //select device
                    foreach (BluetoothDeviceInfo bthDevice in bdi)
                    {
                        if (bthDevice.DeviceName == strMyDevice)
                        {
                            dev = bthDevice;
                            break;
                        }
                    }
    
          /*/////////////////connecting://////////////////////////////*/
    
          /* if  in constructor i use BluetoothService.ObexObjectPush,*/
          /* i get "The requested address is not valid in its context"...dunno why*/             
          BluetoothEndPoint stationEP;
          stationEP = new BluetoothEndPoint(dev.DeviceAddress, BluetoothService.ObexFileTransfer);  
          bc.Connect(stationEP);
    
                    //if i'm connected...
                    if (bc.Connected)
                    {
                          /// OK !
                    } 
         }
    
    Ok, so far so good.Everything works fine........
    Now i have to connect and start using OBEX service...step two:
    
       //define the stream
       NetworkStream peerStream = bc.GetStream();
    
      try
      {
        ObexClientSession sess = new ObexClientSession(peerStream, UInt16.MaxValue);
        sess.Connect();
      }
      catch(ProtocolViolationException pex)
      {
        /*  ERROR MESSAGE I GET HERE: "Overrun PDU in parsing."  */
    
         lblInfo.Text = "Connect failed...[" + pex.Message + "]"; 
         return;
       }
       catch (Exception ex)
       {
          lblInfo.Text = "Connect failed...[" + ex.GetType().ToString() + "]";
          return;
        }
    
    So, this is where i stopped making progresses....I get that error ("Overrun PDU in parsing.")
    when try to connect to OBEX service....I don't know what would follow next :)
    But first i have to deal with this problem. 
    By the way...i tried to send a file from device to desktop and it worked fine
    (except some garbage appended to the end of filename when it arrived on PC: %EF%BF%BD) 
    Any ideas about this error ? Or any other way ? 
    I will also need to display some progress of file downloading...
    
    Thanks in advance !
    
  • 11-22-2007 11:44 AM In reply to

    Re: Problems on sending file to device !

    I think the problem is that the device is not in discoverable mode...but as i said in my previous post, since the device is on Windows CE 5.0 platform, i don't have access to RadioMode enumaration due to missing file, bthutil.dll.....The API i was talking about in my previous post, provided by device's supplier, only enable/disable power status and retrieves power status from bluetooth module. Is there any way to make the device discoverable, because i think that is the reson for my problem...?
  • 11-23-2007 6:46 AM In reply to

    Re: Problems on sending file to device !

    When connecting to an ObexFileTransfer server one needs to do the corresponding OBEX Connect operation i.e. sess.Connect(ObexConstant.Target.FolderBrowsing).  Otherwise the server will return an error[1] -- here I think the server is sending back a illegally formed connect response[2].  That should work now.

    Andy

     

    Notes 

    [1] On IrDA one connects to the same Service Name endpoint for both OBEX service types so the OBEX Connect operation needs to specify which is wanted.  On Bluetooth different service ids are used for the two service types, but the OBEX Connect operation still needs to match.

    [2] The OBEX Connect request and response packet contain extra bytes to a normal packet (yuck!), I guess here that the server is forgetting that it is sending the error packet as a connect response so sends the normal packet format (obex13.pdf section 3.3.1.8 "A fail response still includes the [extra bytes]") and thus the error  -- this was the CE Obex server?

  • 11-23-2007 8:03 AM In reply to

    Re: Problems on sending file to device !

    The EF-BF-BD byte sequence is the UTF-8 encoding of U+FFFD which is "REPLACEMENT CHARACTER", so somewhere there was a conversion where the original string contained bad characters.  .NET is natively UCS-2, so where are you seeing the string in UTF-8?

    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.
  • 11-24-2007 10:57 AM In reply to

    Re: Problems on sending file to device !

    Hello!
    alanjmcf:

    The EF-BF-BD byte sequence is the UTF-8 encoding of U+FFFD which is "REPLACEMENT CHARACTER", so somewhere there was a conversion where the original string contained bad characters.  .NET is natively UCS-2, so where are you seeing the string in UTF-8?

    The EF-BF-BD byte sequence is appended to the filename of the file received from terminal on desktop station..From device i send the file "test.txt" and when it arrives on desktop its name is "test.txt%EF%BF%BD" ....The content of the file seems to be OK... The sequence of code for sending file from terminal is as follows:
     //define the stream
     NetworkStream service;
    
     //get the stream
     service = btClient.GetStream();
    
     //connect to OBEX server
     ObexClientSession sessionFileSending = new ObexClientSession(service, 65535);
     sessionFileSending.Connect();
    
     //load the file to send
     FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read);
    
     //send file to PC station  
     sessionFileSending.PutFrom(file, file.Name, null);
    
  • 11-24-2007 11:17 AM In reply to

    Re: Problems on sending file to device !

    Andy Hume:

    When connecting to an ObexFileTransfer server one needs to do the corresponding OBEX Connect operation i.e. sess.Connect(ObexConstant.Target.FolderBrowsing).  Otherwise the server will return an error[1] -- here I think the server is sending back a illegally formed connect response[2].  That should work now.

    Andy

     

    Notes 

    [1] On IrDA one connects to the same Service Name endpoint for both OBEX service types so the OBEX Connect operation needs to specify which is wanted.  On Bluetooth different service ids are used for the two service types, but the OBEX Connect operation still needs to match.

    [2] The OBEX Connect request and response packet contain extra bytes to a normal packet (yuck!), I guess here that the server is forgetting that it is sending the error packet as a connect response so sends the normal packet format (obex13.pdf section 3.3.1.8 "A fail response still includes the [extra bytes]") and thus the error  -- this was the CE Obex server?

    Andy, i did what you say except the fact that i used the other override of the Connect() function (the one without no parameters)..However, using your override: sess.Connect(ObexConstant.Target.FolderBrowsing) still throw me the same error ("Overrun in PDU parsing.") The OBEX server is indeed the CE device. However, the error ("Overrun in PDU parsing") is received on OBEX client (that is, the PC station). On the device i don't get any error, since no appplication is running...Only the bluetooth module is powered on. I tried to write a small application on CE device that will put the device in discoverable mode, but since the RadioMode enum throw me an exception, since bthutil.dll is not present on device, i cannot use it...Anyway, i'm not sure that this is the problem, since the connection from desktop to device works fine (by using the BluetoothClient and BluetoothEndPoint classes) prior to OBEX connection...I don't know where to look in order to solve the problem....Do you think it might be a problem with the device ? I tried to use a third party application from the desktop in order to get the services available on the device but the SDP inquiry return nothing...Also, using my Nokia N72 mobile phone instead the CE device, the transfer from desktop to phone worked fine !. What are your suggestion(s) ? Thank you!
  • 11-26-2007 5:43 AM In reply to

    Re: Problems on sending file to device !

    Ok lets check exactly what the server is sending back.  If you copy the "Enable Network Logging, rename to app.exe.config" file from the Brecham.Obex samples folder to the same folder as your app, and rename it to match (or if you've a config file already then merge its contents).  When you run your app you'll get a file called network.log showing the bytes that were sent and recevied.  Copy it here.  Try when connecting to both the Connect Targets.

    Does Windows' Bluetooth File Transfer Wizard fail when sending to the CE device too?


    For browsing the device's services you can use the new SdpBrowser samples in the new 32feet.NET release.  Run it, do discovery, select your device and then click 'All services over L2cap' (or whatever the exact text is) and it'll show all the services.  Copy it here too.
     

    Andy 

  • 11-26-2007 5:44 AM In reply to

    Re: Problems on sending file to device !

    I wonder whether the filename on disk contains a bad character.  Can you compare and double check the contents of the fileName variable and the file.Name property.  Check the String.Length of each and dump their raw bytes with e.g.

        string s = set to fileName/file.Name
        byte[] buf = System.Text.Encoding.Unicode.GetBytes(s);
        Console.WriteLine("String.Length: {0}, buf.Length: {1} (should be x2)", s.Length, buf.Length);
        Console.WriteLine(BitConverter.ToString(buf));

    Andy

  • 11-26-2007 11:34 AM In reply to

    Re: Problems on sending file to device !

    Hello Andy,

    First of all, thank you for your interest in the problem i got into. Ok, so i'll start by telling you that using the Windows File Transfer Wizard worked OK in sending file to device..However, before sending the file to device, i need to run a small app on device..This small app uses the following code:
    private void btnListen_Click(object sender, EventArgs e)
    {            
      ObexListener listener = new ObexListener(ObexTransport.Bluetooth);
      if (!listener.IsListening)
      {
         listener.Start();
         lblInfo.Text = "Start listening...";
         Application.DoEvents();
         DealWithRequest(listener);
      }
    }
    
     private void DealWithRequest(ObexListener listener)
     {
       while (listener.IsListening)
       {
         try
         {
            ObexListenerContext olc = listener.GetContext();
            ObexListenerRequest olr = olc.Request;
            string filename = olr.RawUrl;
            olr.WriteFile("\\My Documents\\" + filename);
            lblInfo.Text = "ok";
          }
          catch (Exception ex)
          {
              lblInfo.Text = "error";
          }
       }
    }
    
    If i don't run this code in order to listen for incoming connections, and i just power on bluetooth device but no application running, i get the following error from Windows Bluetooth File Transfer Wizard: "The OBEX service on the destination computer or device is not available or ready for the transfer. Please try again. If you still cannot complete the transfer, read the manufacturer's documentation that came with the device."

    OK, let's move on.... I copied the app.config file in my desktop app folder, enabled logging (network.log) and got the following:
    System.Net.Sockets Verbose: 0 : [5104] Socket#66074150::Socket(32#32)
    System.Net.Sockets Verbose: 0 : [5104] Exiting Socket#66074150::Socket() 
    System.Net.Sockets Verbose: 0 : [5104] 
       Socket#66074150::Connect(00043E000000:0000110600001000800000805f9b34fb#1040187396)
    System.Net.Sockets Verbose: 0 : [5104] Exiting Socket#66074150::Connect() 
    System.Net.Sockets Verbose: 0 : [5104] Socket#66074150::Send()
    System.Net.Sockets Verbose: 0 : [5104] Data from Socket#66074150::Send
    System.Net.Sockets Verbose: 0 : [5104] 
       00000000 : 80 00 1A 10 00 FF FF 46-00 13 F9 EC 7B C4 95 3C : .......F....{..<
    System.Net.Sockets Verbose: 0 : [5104] 
       00000010 : 11 D2 98 4E 52 54 00 DC-9E 09                   : ...NRT....
    System.Net.Sockets Verbose: 0 : [5104] Exiting Socket#66074150::Send() 	-> 26#26
    System.Net.Sockets Verbose: 0 : [5104] Socket#66074150::Receive()
    System.Net.Sockets Verbose: 0 : [5104] Data from Socket#66074150::Receive
    System.Net.Sockets Verbose: 0 : [5104] 00000000 : C3 00 03    : ...
    System.Net.Sockets Verbose: 0 : [5104] Exiting Socket#66074150::Receive() 	-> 3#3
    
    I have to mention that in both applications (desktop and device) i used InTheHand.Net.Personal.dll v2.1.0.0 (of course, XP assembly for desktop and CF2 assembly for device). However, using the latest version (that is, v2.2.0.0) returned the same result. Another thing i should mention (although is not crucial for my problem...or at least i THINK it isnt) is that the assembly TransportConnection in which resides Brecham.Obex.Net namespace, has a reference to InTheHand.Net.Personal.dll v2.0.60828, making it unusable with later versions of InTheHand.Net.Personal.dll....I tried to recompile the project, but i had to eliminate the unit testing portion from it (NUnit assembly), so i quit :)).

    OK, next.... I ran the SdpBrowser sample for desktop, made the discovery, select my Windows CE device and got the following results:
    • Record:
    
    AttrId: 0x0000 -- ServiceRecordHandle
    UInt32: 0x0
    
    AttrId: 0x0001 -- ServiceClassIdList
    ElementSequence
        Uuid16: 0x1000 -- ServiceDiscoveryServer
    
    AttrId: 0x0004 -- ProtocolDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x100 -- L2CapProtocol
            UInt16: 0x1
        ElementSequence
            Uuid16: 0x1 -- SdpProtocol
    ( ( L2Cap, PSM=Sdp ), ( Sdp ) )
    
    AttrId: 0x0006 -- LanguageBaseAttributeIdList
    ElementSequence
        UInt16: 0x656E
        UInt16: 0x6A
        UInt16: 0x100
    
    AttrId: 0x0100 -- ServiceName
    TextString: [en] 'Service Discovery'
    
    AttrId: 0x0101 -- ServiceDescription
    TextString: [en] 'Publishes services to remote devices'
    
    AttrId: 0x0102 -- ProviderName
    TextString: [en] 'Microsoft'
    
    AttrId: 0x0200 -- VersionNumberList
    ElementSequence
        UInt16: 0x100
    
    AttrId: 0x0201 -- ServiceDatabaseState
    UInt32: 0x9
    
    
    • Record:
    
    AttrId: 0x0000 -- ServiceRecordHandle
    UInt32: 0x10000
    
    AttrId: 0x0001 -- ServiceClassIdList
    ElementSequence
        Uuid16: 0x1112 -- HeadsetAudioGateway
        Uuid16: 0x1203 -- GenericAudio
    
    AttrId: 0x0004 -- ProtocolDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x100 -- L2CapProtocol
        ElementSequence
            Uuid16: 0x3 -- RFCommProtocol
            UInt8: 0x1
    ( ( L2Cap ), ( Rfcomm, ChannelNumber=1 ) )
    
    AttrId: 0x0009 -- BluetoothProfileDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x1108 -- Headset
            UInt16: 0x100
    
    AttrId: 0x0100
    TextString (guessing UTF-8): 'Voice Gateway'
    
    
    • Record:
    
    AttrId: 0x0000 -- ServiceRecordHandle
    UInt32: 0x10001
    
    AttrId: 0x0001 -- ServiceClassIdList
    ElementSequence
        Uuid16: 0x111F -- HandsfreeAudioGateway
        Uuid16: 0x1203 -- GenericAudio
    
    AttrId: 0x0004 -- ProtocolDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x100 -- L2CapProtocol
        ElementSequence
            Uuid16: 0x3 -- RFCommProtocol
            UInt8: 0x2
    ( ( L2Cap ), ( Rfcomm, ChannelNumber=2 ) )
    
    AttrId: 0x0009 -- BluetoothProfileDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x111E -- Handsfree
            UInt16: 0x101
    
    AttrId: 0x0100
    TextString (guessing UTF-8): 'Voice Gateway'
    
    AttrId: 0x0301
    UInt8: 0x1
    
    AttrId: 0x0311 -- SupportedFeatures
    UInt16: 0x21
    
    
    • Record:
    
    AttrId: 0x0000 -- ServiceRecordHandle
    UInt32: 0x10002
    
    AttrId: 0x0001 -- ServiceClassIdList
    ElementSequence
        Uuid16: 0x1106 -- ObexFileTransfer
    
    AttrId: 0x0004 -- ProtocolDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x100 -- L2CapProtocol
        ElementSequence
            Uuid16: 0x3 -- RFCommProtocol
            UInt8: 0x3
        ElementSequence
            Uuid16: 0x8 -- ObexProtocol
    ( ( L2Cap ), ( Rfcomm, ChannelNumber=3 ), ( Obex ) )
    
    AttrId: 0x0006 -- LanguageBaseAttributeIdList
    ElementSequence
        UInt16: 0x656E
        UInt16: 0x6A
        UInt16: 0x100
    
    AttrId: 0x0009 -- BluetoothProfileDescriptorList
    ElementSequence
        ElementSequence
            Uuid16: 0x1106 -- ObexFileTransfer
            UInt16: 0x100
    
    AttrId: 0x0100 -- ServiceName
    TextString: [en] 'FTP'
    
    
    So, as far as i can tell, it seems that the ObexFileTransfer service is there and is OK.... What do you think ?


    Thank you!
  • 11-26-2007 12:23 PM In reply to

    Re: Problems on sending file to device !

    Andy Hume:

    I wonder whether the filename on disk contains a bad character.  Can you compare and double check the contents of the fileName variable and the file.Name property.  Check the String.Length of each and dump their raw bytes with e.g.

        string s = set to fileName/file.Name
        byte[] buf = System.Text.Encoding.Unicode.GetBytes(s);
        Console.WriteLine("String.Length: {0}, buf.Length: {1} (should be x2)", s.Length, buf.Length);
        Console.WriteLine(BitConverter.ToString(buf));

    Andy

    I checked the lenght and content of filename and file.Name proeprty. The fileName variable and file.Name property has the value: "\\Program Files\\invoices\\test.txt" (without quotes) the length and raw bytes are:
    String.Length: 32, buf.Length: 64 (should be x2)
    5C-00-50-00-72-00-6F-00-67-00-72-00-61-00-6D-00-20-00-46-00-69-00-6C-00-65-
    00-73-00-5C-00-69-00-6E-00-76-00-6F-00-69-00-63-00-65-00-73-00-5C-00-74-00-
    65-00-73-00-74-00-2E-00-74-00-78-00-74-00
    
    So, it seems nothing is wrong here... Another thing that i think worths to mention is that in the function where i make the device discoveries (i'm talking about the device application which send the file to desktop) i get a strange error messge in Debug Output Window in VS.NET ("A first chance exception of type 'System.FormatException' occurred in InTheHand.Net.Personal.dll") after executing line "BluetoothDeviceInfo[] devices = bthClient.DiscoverDevices();". The version of InTheHand.Net.Personal.dll is 2.2.0.0 :
    private BluetoothClient ConnectToDevice(string stationName)
    {
       BluetoothClient bthClient = new BluetoothClient();
       BluetoothDeviceInfo station = null;
    
       //discovery bluetooth devices
       BluetoothDeviceInfo[] devices = bthClient.DiscoverDevices();   //--> HERE IS EXCEPTION!
    
       //search for PC station
       foreach (BluetoothDeviceInfo bthDevice in devices)
       {
          .
          .
          .
    
    Of course, everything works fine from this point on, but i thought you should know that...
  • 11-28-2007 5:12 AM In reply to

    Re: Problems on sending file to device !

    a) Running your own OBEX server is a good way to get this functionality, though I'd have expected that the manufacturer would include an OBEX Object Push Profile server if the included the more complex OBEX File Transfer Profile server.  Perhaps the registry setting for the former just haven't been added to the registry by the manufacturer?

    b) Yup the trace shows what I expected.  An error code in a bad non-connect-response PDU.  I've just made a change to the library so that it looks for that case and allows the error code to be reported (ObexResponseException: Unexpected OBEX response code: 0xC3 (Forbidden).) rather than reporting the protocol violation.

    As we see there, the error code it reports is C3 which is "Forbidden".  Now there's a separate code for requesting OBEX authentication (0xC1=Unauthorized), but maybe the forbidden code is produced because the server requires Bluetooth authentication; are the two machine set mutually as paired/trusted devices?  Or, the Widcomm/Broadcom applications prompt the local user to allow the connection, there's no prompt on CE is there?

    c) Yup the library version mismatch was to be expected.  I'll ship a new version sometime soon referencing the new 32feet.NET library. As you found, only theTransportConnection library was affected and you weren't using it yourself.  (If you wanted to try the samples there were various ways to work around the issue, copying the library file to the project folder and resetting the reference or reference paths value, or as you noted, reconfiguring the TransportConnection library.  Without NUnit installed compiling the Release configuration, or removing the NUNIT #define from the Debug configuration would work.)

    d) Yup the FTP record looks good.


    So depending on your requirements.  I'd speak to the manufacturer to see whether they intended the OPP server to be active, and what the FTP server needs to accept a connection.  Or just write an application to run on the machine and run its own OPP server.

    Andy 

  • 11-29-2007 5:35 AM In reply to

    Re: Problems on sending file to device !

    Hello Andy, 
    
    I tried to change the BluetoothService i'm connecting to...so, instead of:
    
     //define an EndPoint for the PC station and connect to it
    BluetoothEndPoint stationEP = 
              new BluetoothEndPoint(station.DeviceAddress, BluetoothService.ObexFileTransfer);               
    bc.Connect(stationEP);
    
    i used :
    
     //define an EndPoint for the PC station and connect to it
    BluetoothEndPoint stationEP = 
               new BluetoothEndPoint(station.DeviceAddress, BluetoothService.ObexObjectPush);               
    bc.Connect(stationEP);
    
    and the trace i got was:
    
    System.Net.Sockets Verbose: 0 : [3680] Socket#53578024::Socket(32#32)
    System.Net.Sockets Verbose: 0 : [3680] Exiting Socket#53578024::Socket() 
    System.Net.Sockets Verbose: 0 : [3680]
           Socket#53578024::Connect(00043E000000:0000110500001000800000805f9b34fb#1040187396)
    System.Net.Sockets Verbose: 0 : [3680] Exiting Socket#53578024::Connect() 
    System.Net.Sockets Verbose: 0 : [3680] Socket#53578024::Send()
    System.Net.Sockets Verbose: 0 : [3680] Data from Socket#53578024::Send
    System.Net.Sockets Verbose: 0 : [3680] 
           00000000 : 80 00 1A 10 00 FF FF 46-00 13 F9 EC 7B C4 95 3C : .......F....{.. 26#26
    System.Net.Sockets Verbose: 0 : [3680] Socket#53578024::Receive()
    System.Net.Sockets Verbose: 0 : [3680] Data from Socket#53578024::Receive
    System.Net.Sockets Verbose: 0 : [3680] 00000000 : A0 00 07                : ...
    System.Net.Sockets Verbose: 0 : [3680] Exiting Socket#53578024::Receive() 	-> 3#3
    System.Net.Sockets Verbose: 0 : [3680] Socket#53578024::Receive()
    System.Net.Sockets Verbose: 0 : [3680] Data from Socket#53578024::Receive
    System.Net.Sockets Verbose: 0 : [3680] 00000003 : 10 00 20 00             : .. .
    System.Net.Sockets Verbose: 0 : [3680] Exiting Socket#53578024::Receive() 	-> 4#4
    
    
    So, after my knowledge the first response from device 
    which starts with A0 means that the response was ok ?
    This time the exception was not a ProtcolViolation exception
    but Brecham.Obex.ObexResponseException..
    Anyway it still didnt send the file into device
    
    If i deregister the desktop from the device and than try to connect again from desktop
    to device, yes, on the device it pops-up the dialog asking me to input the PIN .
    
    Any clues about this new trace response ?
    										    
    									    
  • 11-29-2007 11:19 AM In reply to

    Re: Problems on sending file to device !

    For the Default/Inbox OBEX server, one uses:

    • IrDA Service Name: OBEX
    • Bluetooth Profile: OPP
    • BluetoothService.ObexObjectPush
    • OBEX Connect Target: blank i.e. use ObexClientSession.Connect().

    For the Folder Browsing Service, one uses:

    • IrDA Service Name: OBEX
    • Bluetooth Profile: FTP
    • BluetoothService.ObexFileTransfer
    • OBEX Connect Target: FolderBrowsing i.e. use ObexClientSession.Connect(ObexConstant.Target.FolderBrowsing).

    So in your new example change the sess.Connect(...); line to sess.Connect();  :-)

    (By returning no Target header in its connect response the server has indicated that it doesn't support the FolderBrowsing Service and thus we raise an error locally.  See the class documentation on method "ObexClientSession.Connect Method (Byte[])").

  • 11-30-2007 2:13 PM In reply to

    Re: Problems on sending file to device !

    Hello Andy, You were right ! :-) WIndows CE doesn't support FolderBrowsing Service and that was the reson for the exception. The Connect() method did it's job! Now it's working ! Thank you for helping me in solving this issue. Now, another thing i want to ask you, although this question should be in another thread...but since you're reading this lines.... Is it possible, to RETRIEVE a file from device to desktop using the same connection (desktop being the client who make the request and device being the server) ?
  • 12-03-2007 11:47 AM In reply to

    Re: Problems on sending file to device !

    I think i figure it out. In order to get a file from device (the desktop being the client and the device being the server) i'll have to use GET which can be applied only when connecting to FolderBrowsing service...Since my device doesnt support FolderBrowsing service, it seems that i can't use the desktop app to get files from device...only send. Is this right ? Now, when i send the file from desktop to device, everything goes smooth...On the server side (the device) i'm listening for incoming requests using ObexListener.GetContext() which is blocking until the file is uploaded completely. Ok, suppose i dont need in advance (before file being completely received on device) who send the file but one strange thing happens if I abort the transfer of file operation on desktop. When i aborted, using ObexPutStream.Abort(), a command console appears on my device with two numbers: "255 3" and nothing happens...The desktop app freezes and i don't know why that happens. Can you help me on that ?
Page 1 of 2 (19 items) 1 2 Next >
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.