# nmb.NetBIOS Objects

A nmb.NetBIOS object can be created using the following constructor.

NetBIOS(servport = nmb.NETBIOS_NS_PORT)
  Creates a nmb.NetBIOS object where all future queries will be sent through servport. nmb.NETBIOS_NS_PORT is standard port (137) for NetBIOS name service. All queries will be broadcasted using the default broadcast address. Raised NetBIOSError if we cannot bind to a UDP port.

nmb.NetBIOS objects have the following methods.

set_nameserver(nameserver)
  Set the default NetBIOS domain nameserver. All name service queries will be sent to this server. The nameserver parameter should be a string containing a valid hostname or IP address. Use None if you wish to reset to using broadcast address for query.

get_nameserver() -> string
  Returns the default NetBIOS domain nameserver, or None if none is specified

set_broadcastaddr()
  Set the broadcast address to be used for query.

get_broadcastaddr() -> string
  Return the broadcast address to be used, or nmb.BROADCAST_ADDR if default broadcast address is used.

gethostbyname(nbname, type = TYPE_WORKSTATION, scope = None, timeout = 1) -> [ <nmb.NBHostEntry instance> ... ]
  Returns a list of NBHostEntry instances containing the host information for nbname. If a NetBIOS domain nameserver has been specified, it will be used for the query. Otherwise, the query is broadcasted on the broadcast address. timeout should be an int specifying the number of seconds to wait for reply. Raises NetBIOSTimeout if timeout (in secs) is reached. Raises NetBIOSError for other errors.

getnodestatus(nbname, destaddr = None, type = TYPE_WORKSTATION, scope = None,timeout = 1) -> [ <nmb.NBNodeEntry instance> ... ]
  Returns a list of NBNodeEntry instances containing node status information for nbname. If destaddr contains an IP address, then this will become an unicast query on the destaddr. Raises NetBIOSTimeout if timeout (in secs) is reached. Raises NetBIOSError for other errors.

nmb Module

Last modified on Mon, Aug 20 2001