IRDA file transfer problems

I am trying to trasfer some database files using IRDA between PPC 2003 devices running the compact framework 2. When transfering a very small text file, it works fine. When transferring a 288KB .sdf file, I get an IOException on both devices. I am using c# using the sample code provided here: http://msdn2.microsoft.com/en-us/library/system.net.sockets.irdaclient.aspx#Mtps_DropDownFilterText

Looking at the code, I don't see any reason for it to throw an exception. On the receiving device I get this exception: IOException Unable to read data from the transport connection. On the sending device I get this exception: IOException Unable to write data to the transport connection. It is not consistent exactly how many times it will loop before throwing the exception but it always happens within the while loop in these two places:

on the sending device inside: Send_Click(object sender, System.EventArgs e) at:
baseStream.Write(buffer, 0, numRead);

on the receiving device: inside: Receive_Click(object sender, System.EventArgs e) at:
int numRead = baseStream.Read(buffer, 0 , buffer.Length);

Any help will be greatly appreciated!



Answer this question

IRDA file transfer problems

  • rpp

    I've attempted to use the MSDN sample code to send files of varying sizes, including northwind.sdf which was 1.32Mb in size, with no problems. I simply substituted my files into the sample code and everything worked. Could your devices' IrDA be shutting down for some reason Perhaps you have altered the code in some way



  • HillBillyB

    As I said before in my earlier post I transfered files greater than the buffer size with no problems using the MSDN sample so I'm not sure what the problem in your situation could be. Could it be device related I tried it on Dell Axim running Windows Mobile 5 and a Compaq Ipaq running Pocket PC 2003.

  • subir.talukder

    If I change that line in the constructor to be:
    buffersize = 500
    then 500 bytes becomes the new barrier.

  • DavidThi808

    I tried copying the source code from the example exaclty. When I run the program I still cannot get past the 256 byte barrier. Anything larger than 256 bytes fails, although I do get the first 256 bytes of it.
    It still seems like a code issue:
    buffersize = 256;

  • NotMyself

    I still cannot get this to work! The code I am working from is from the .net class library documentation, so it should work! Here is the website:
    http://msdn2.microsoft.com/en-us/library/system.net.sockets.irdaclient.aspx#
    Is anybody else having this problem please help me.

  • Ryan F

    I was originally testing 2 Dell Axim X5 units running Pocket PC 2003. I got my hands on a couple hp units that were also running Pocket PC 2003, so I tested the program on those and it worked just fine. So, I guess it is a problem specific to the Dell Axim X5 devices.
  • Lameck

    Yeea Wat it do im triing to download media files to my ppc and it dont seem to work wat am i missin
  • Humaneast

    I still have not figured this one out. Is that example only designed for text files, or is it set up for any file type The only other thing that I can think of is that it is a hardware limitation (maybe due to the file size ). Has anyone here used IR to transfer large files

  • MagedSalah

    I tried it again with text files. I tried it with a text file that was slightly smaller than buffersize(256 bytes). This works fine. Then I tried it again with a text file that was slightly larger than 256 bytes. This throws an IOException. For the receiving device I used the degugger to see exactly what was happeinig in the while loop where it tries to read the file being sent. It goes through it just fine the first time, so the first 256 bytes of the file is read just fine. Then when it tries to loop again it throws the exception on the read line. Here is the exact exception information:
    System.IO.IOException
    "Unable to read data from the transport connection"
    inner exception:
    System.Net.Sockets.SocketException
    "An existing connection was forcibly closed by the remote host"

    Is there some kind of timout setting I can change somewhere

  • IRDA file transfer problems