nmb.NetBIOSSession Objects
A nmb.NetBIOSSession object can be created using the following constructor.
- NetBIOSSession(myname, remote_name, remote_host, host_type = nmb.TYPE_SERVER, sess_port = nmb.NETBIOS_SESSION_PORT)
- Setup a NetBIOS over TCP/IP session between 2 NetBIOS names, myname and remote_name. Note that some machines might reject the connection if remote_name does not belong to their machines. remote_host should be a string containing the hostname or IP address of the remote machine. host_type is used to specify the type of the remote host.
nmb.NetBIOSSession objects has the following methods.
- get_myname() -> string
- Return the NetBIOS name of the local machine.
- get_remote_name() -> string
- Return the NetBIOS name of the remote machine.
- get_remote_host() -> string
- Return the hostname or IP address of the remote machine
- close()
- Close the current session. Any future read/write on this session will result in error.
- send_packet(data)
- Send a SMB data packet to the remote machine. The length of the data must not be more than 65535. Raises nmb.NetBIOSError if error occurs when sending the packet.
- recv_packet(timeout = None) -> string
- Attempts to read in a data packet within timeout (in secs). Raises nmb.NetBIOSTimeout when timeout (in secs) is reached before data is received. Raises nmb.NetBIOSError if error occurs when receiving the packet.
Last modified on Tue, Oct 2 2001