/
dgd-net/
dgd-net/doc/
dgd-net/doc/kfun/
dgd-net/src/host/unix/
dgd-net/src/kfun/
NAME
	open_port - associate an object with an internet port

SYNOPSIS
	void open_port(object obj, int port, string protocol)


DESCRIPTION
	Open a port on the host machine and connect it to obj.  This object
	is then known as a "port object".  The protocol may be any of "tcp",
	"udp", or "telnet".  What happens to the port object depends on the
	protocol.

	When a port is first opened, open() is called in its port object.
	When it is closed for any reason, close() is called in its port object.
	Destructing a port object will close its port first.

	In a telnet or tcp port, connection(string ipnumber, int port) will
	be called whenever a client connects to its port.  This function
	should return an object that will then be known as a "user object".

	In an udp port, 

	    receive_datagram(string data, string ipnumber, int port)

	will be called whenever a datagram arrives on its port.  The
	ipnumber and port will be those of the sender.  Udp port objects
	may also send datagrams.

	Only the driver object can use this function.

SEE ALSO
	kfun/send_datagram, kfun/send_message, kfun/connect