[BangPypers] reqiured help for final year project - urgent

Anand Balachandran Pillai abpillai at gmail.com
Wed Apr 23 09:31:06 CEST 2008


You are sending and receiving only 1024 bytes of data, so how
do you expect large files such as image or audio files to go through ?
You need to chunk your data to readable small pieces something
in the range of 4-16 kib (4096-16384 bytes) and keep reading
and sending the bytes in a loop to the server, until there are no
more bytes left.

On the server also, keep reading from the socket until there is no
more data left in the channel or you get an exception. Try using
threads in the server and also increasing the backlog.

--Anand

On Wed, Apr 23, 2008 at 12:50 PM, Amal <raj.amal at gmail.com> wrote:
>
> If you tell what the problem is then may be we can help.
>
> One issue I noticed is you are using csoc.recv(1024) . Which is tooo small
> for the other file formats. So what u can do is write a loop there to
> receive the entire data. Basically when u say csoc.recv(1024) It reads only
> 1024 bytes from the socket and remaining are not read.  And use "rb" only
> for the reading.
>
> And hereafter tell what is the problem in the mail, rather than just saying
> its not working. It will help us understand the problem.
>
> regards,
> Amal.
>
>
>
> On Wed, Apr 23, 2008 at 12:26 PM, Prajakta Chaudhari <pc_3110 at yahoo.co.in>
> wrote:
>
> > Sir,
> >
> > We were suggested your name by a friend of ours in Thadomal Sahani
> Engineering College. We are students of K. J. Somaiya College of
> Engineering. We are doing our final year project in Python and need some
> help.
> > Our project is : we wanted to transfer all types of files(.txt, .jpg,
> .mp3, .mpeg and so on) automatically from the phone to our computer using
> Bluetooth. Whenever our phone comes in the range of the computer Bluetooth
> dongle, it must update any file, which has been recently updated on the
> phone, onto the computer. Until now, we have just been able to transfer .txt
> files over Bluetooth. We are facing problems in transferring other files.
> >
> > Our codes are:
> >
> > Phone code:
> >
> > import sys, socket
> > host = "11:11:11:11:11:11"
> > port = 10
> > file = "E:\\Data\\2.txt"
> > s = socket.socket(socket.AF_BT, socket.SOCK_STREAM)
> > s.connect((host, port))
> > f = open(file, "r")
> > data = f.read()
> > f.close()
> > s.send(data)
> > s.close()
> >
> > Here, for transferring other types of files, we tried using opening the
> files with read binary; "rb", format. But that approach has not worked.
> >
> > Computer code:
> >
> > from Bluetooth import *
> > port =10
> > backlog = 1
> > file = "C:\Documents and Settings\sanjay\Desktop\Transfer\File.txt"
> > host = "11:11:11:11:11:11"
> > soc = BluetoothSocket(RFCOMM)
> > soc.bind((host, port))
> > soc.listen(backlog)
> > csoc, cinfo  = soc.accept()
> > csoc.recv(1024)
> > csoc.close()
> > soc.close()
> >
> > Kindly help us out with this problem of ours. Looking forward to your
> reply.
> >
> > Thanking you,
> >
> > Yours sincerely,
> >
> > Prajakta Chaudhari
> > Priya Mathur
> > (K. J. Somaiya College Of Engineering – Electronics and Telecommunication
> Engineering)
> >
> >
> >      Meet people who discuss and share your passions. Go to
> http://in.promos.yahoo.com/groups/bestofyahoo/
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
>
> --
> Amal
> _______________________________________________
>  BangPypers mailing list
>  BangPypers at python.org
>  http://mail.python.org/mailman/listinfo/bangpypers
>
>



-- 
-Anand


More information about the BangPypers mailing list