Tnm::udp(n) Tnm Tcl Extension Tnm::udp(n) ________________________________________________________________________________ NAME Tnm::udp - Send and receive UDP datagrams. _________________________________________________________________ DESCRIPTION The Tnm::udp command allows to send and receive datagrams using the User Datagram Protocol (UDP) (RFC 768). UDP COMMAND Tnm::udp open [port] The Tnm::udp open command opens a UDP datagram socket and returns a handle. The socket is bound to a given port number or name. An unused port number is used if the port argument is missing. Tnm::udp connect host port The Tnm::udp connect command opens a UDP datagram socket and connects it to a port on a remote host. A connected UDP socket only allows to send messages to a single destination. This usually allows to shorten the code since there is no need to specify the destination address for each Tnm::udp send command on a connected UDP socket. The command returns a udp handle. Tnm::udp send handle [host port] message The Tnm::udp send command sends a datagram containing message to the destination specified by host and port. The host and port arguments may not be used if the UDP handle is already connected to a transport endpoint. If the UDP handle is not connected, you must use these optional arguments to specify the destination of the datagram. Tnm::udp receive handle The Tnm::udp receive command receives a datagram from the UDP socket associated with handle. This command blocks until a datagram is ready to be received. In most cases, it might be a good idea to check for pending datagrams using the Tnm::udp bind command. Tnm::udp close handle The Tnm::udp close command closes the UDP socket associated with handle. Tnm::udp bind handle readable [script] Tnm::udp bind handle writable [script] The Tnm::udp bind command allows to bind scripts to a UDP handle. A script is evaluated once the UDP handle becomes either readable or writable, depending on the third argument of the Tnm::udp bind command. The script currently bound to a UDP handle can be retrieved by calling the udp bind command without a script argument. Bindings are removed by binding an empty string. Tnm::udp info [handle] The Tnm::udp info command without the handle argument returns a list of all existing UDP handles. Information about the state of a UDP handle can be obtained by supplying a valid UDP handle. The result is a list containing the source IP address, the source port, the destination IP address and the destination port. SEE ALSO scotty(1), Tnm(n), Tcl(n) AUTHORS Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de> Tnm December 1997 Tnm::udp(n)