| Reply | « Previous Thread | Next Thread » |
|
Hy there!
I'm working on a wireless file-transfer program over bluetooth. Its rather hard to find any dokumentation about this topic, but i at least made it to resolve bluetooth devices in range and establish a connection. the problem i now have is that every time i try to transfer files (obex format) the program crashes and displays socket.error number 13: permission denied. after I googled this error about 3 hours, i gave up, i couldnt find anything. then i tried to use the RFCOMM class to transfer normal streams, but again i got an error. this time it was: socket.error 0: error. googling again, the same result as above: none. i have also searched this forum, but couldnt find anything that fits. The code for obex file transfer(client): def cl_sv_func(target): # target = ('adress', port) # make socket mySocket = socket(AF_BT, SOCK_STREAM) # if there is a server given, play client if isNumberType(target[1]): mySocket.connect(target)# ... else do the server part The code for obex file transfer(server): # mySocket was made bevore, see client # get server channel port = bt_rfcomm_get_available_server_channel(mySocket._sock) # bind socket to port mySocket.bind(("", port)) # advertise service bt_advertise_service( u"bla", mySocket._sock, True, OBEX ) # set security level: authorised set_security(mySocket._sock, AUTHOR) # listen to socket tell("starting listening on Port: " + str(port)) mySocket.listen(1) tell("waiting for connection...") # if there is a connection request: accept myConnection, adress = mySocket.accept() tell("connected to: " + adress + ", " + str(port)) # IO stuff here send_path = u"c:\\simple_send.txt" receive_path = u"c:\\" f=open(send_path, 'w') f.write("hello you") f.close bt_obex_receive(mySocket, receive_path) bt_obex_send_file(adress, port, send_path) # close socket mySocket.close the code is partly from this forum, partly i made it up by myself, but i already found it nearly similar at other places, so should work... but as soon as the client starts to send: socket error 13: permission denied i already tryed to skip the connect() and accept() statements, to see what happens, but error was the same... then i tried to bind the socket at the client part and set the security to author there too. worked, but did not fix the problem. The code for rfcomm stream transfer(client): # nearly same code as up, only with rfcom stream "IO" def cl_sv_func(target): # target = ('adress', port) # make socket mySocket = socket(AF_BT, SOCK_STREAM) # if there is a server given, play client if isNumberType(target[1]): mySocket.connect(target) The code for rfcomm stream transfer(server): # get server channel port = bt_rfcomm_get_available_server_channel(mySocket._sock) # bind socket to port mySocket.bind(("", port)) # advertise service bt_advertise_service( u"bla", mySocket._sock, True, RFCOMM ) # set security level: authorised set_security(mySocket._sock, AUTHOR) # listen to socket tell("starting listening on Port: " + str(port)) mySocket.listen(1) tell("waiting for connection...") # if there is a connection request: accept myConnection, adress = mySocket.accept() tell("connected to: " + adress + ", " + str(port)) # IO stuff here blaa = "workerr" rec = mySocket.recv(3) mySocket.send(blaa.replace('\n','\r\n')) tell(rec) # close socket mySocket.close ... the code is partly from this forum, partly from the nokia simple_bluetooth example, so should work. but again, as soon as the client phone is trying to receive: socket error 0. as said: connection works, but as soon i try to send/receive something: *BOINK* Here are the phones I'm using: Nokia 3230, pythonForSer60 2nEdFP2 => plays the client part Nokia Ngage, pythonForSer60 2nEdFP2 => plays server part If anyone got a clue, why i cant transfer anything, please respond! you guys are my last hope, i dont want to give up days of work...
Last edited by defragger : 2005-08-25 at 09:22.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| socket sending per packet problem | Rx-lee | Symbian Networking & Messaging | 1 | 2005-04-13 14:06 |
| socket server application using Series 60 SDK | irohit | Symbian Networking & Messaging | 0 | 2004-09-16 06:27 |
| socket connection problem | bhatti81 | Mobile Java General | 2 | 2003-10-08 15:43 |
| Problem Socket in 7650 Phone | yaney | Symbian Networking & Messaging | 2 | 2002-11-06 06:37 |
| TCP/IP socket connection problem | ArunP | Symbian Networking & Messaging | 1 | 2002-09-19 11:09 |