Bluetooth txt file byte increases????

Posted by cheesebunz on Stack Overflow See other posts from Stack Overflow or by cheesebunz
Published on 2010-06-01T04:55:51Z Indexed on 2010/06/01 5:03 UTC
Read the original article Hit count: 250

Hi everyone, i am able to xfer files from 1 mobile device to another. When the sender sends this text file of 8 bytes, the receiver end will become a 256bytes txt file and when i open the contents of the txt file, there are my infos plus alot of square boxes. Here is my code from the sender:

            string fileName = @"SendTest.txt";
            System.Uri uri = new Uri("obex://" + selectedAddr + "/" + System.IO.Path.GetFileName(fileName)); 
            ObexWebRequest request = new ObexWebRequest(uri);

            Stream requestStream = request.GetRequestStream(); 
            FileStream fs = File.OpenRead(fileName);

            byte[] buffer = new byte[1024]; 
            int readBytes = 1;

            while (readBytes != 0) 
            {
            readBytes = fs.Read(buffer,0, buffer.Length);
            requestStream.Write(buffer,0, readBytes);
            }

            requestStream.Close();
            ObexWebResponse response = (ObexWebResponse)request.GetResponse();
            MessageBox.Show(response.StatusCode.ToString());
            response.Close();

Any1 knws how do i solve it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about bluetooth