Menu

The difference of bt_socket.bind

Help
aptc
2007-11-17
2013-04-25
  • aptc

    aptc - 2007-11-17

    Suppose I want to receive files forever, this is the test program:

    while 1:
      bt_socket=socket()
      bt_socket.bind(("",9))   
      advertise("Boobee Here!", bt_socket, OBEX)
      obex.recvfile(bt_socket, "test.txt")
      bt_socket.close()

    When i specified the bluetooth adapter's address like this:
    while 1:
      bt_socket=socket()
      bt_socket.bind(("00:0A:3A:7A:70:BB",9))
      advertise("Boobee Here!", bt_socket, OBEX)
      obex.recvfile(bt_socket, "test.txt")
      bt_socket.close()

    something like this would happan:

    Traceback (most recent call last):
      File "test.py", line 5, in <module>
        bt_socket.bind(("00:0A:3A:7A:70:BB",9))
      File "<string>", line 5, in bind
    socket.error: (98, 'Address already in use')

     
    • blam

      blam - 2007-11-18

      You mean if you get this error if you specify the adapter address instead of just using "" when calling bind()? I can't reproduce this myself. There should be no problem with providing the adapter address to bind().

       
    • aptc

      aptc - 2007-11-18

      Yes, that's what I mean. It's all right when you run the program once, everything is ok, but problem shows up at second round when you specify the adapter address.

       
    • aptc

      aptc - 2007-11-18

      Ok, it's my fault, I figured out the problem myself, thank you.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.