module lightblue.obex

Provides operations for sending and receiving files over OBEX.

Functions

recvfile(sock, dest)

    Receives a file through an OBEX service.
    
    Arguments:
        - sock: the server socket on which the file is to be received. Note 
          this socket must *not* be listening. Also, an OBEX service should 
          have been advertised on this socket.
        - dest: a filename or file object, to which the received data will be 
          written. If a filename is given, any existing file will be overwritten.
          If a file object is given, it must be opened for writing. Also it
          must be a real built-in file object, not just an object with file-like
          methods.
    
    For example, to receive a file and save it as "MyFile.txt":
        >>> from lightblue import *
        >>> s = socket()
        >>> s.bind(("", 0))
        >>> advertise("My OBEX Service", s, OBEX)
        >>> obex.recvfile(s, "MyFile.txt")

sendfile(address, channel, source)

    Sends a file to a remote device.
    
    Arguments:
        - address: the address of the remote device
        - channel: the channel of the remote service
        - source: a filename or file object, containing the data to be sent.
          If a file object is given, it must be opened for reading. Also it
          must be a real built-in file object, not just an object with file-like
          methods.