This is automatically generated documentation. Edit after the "COMMENTS" heading; changes to the main body will be lost.
Socket -- Click element; a socket transport (user-level)
Socket("TCP", IP, PORTNUMBER [, LOCALIP] [, LOCALPORTNUMBER] [, KEYWORDS])
Socket("UDP", IP, PORTNUMBER [, LOCALIP] [, LOCALPORTNUMBER] [, KEYWORDS])
Socket("UNIX", FILENAME [, LOCALFILENAME] [, KEYWORDS])
Socket("UNIX_DGRAM", FILENAME [, LOCALFILENAME] [, KEYWORDS])
Ports: at most 1 input, at most 1 output
Drivers: userlevel
Package: userlevel (core)
Transports packets over various types of sockets. Packets do not flow through Socket elements (i.e., Socket is an "x/y" element). Instead, input packets are sent to a remote host or process, and packets received from the remote host or process are emitted on the output. A Socket element of type "TCP" or "UNIX" may be either a server (the default if CLIENT is not set) or a client (if CLIENT is set or if the element has no outputs). If a server, the specified address/port/file is bound and connections are accepted one at a time. If a client, a connection attempt is made to the specified address/port/file during element initialization. A Socket element of type "UDP" or "UNIX_DGRAM" may also be either a server or client. However, because datagram sockets are not connection oriented, a datagram server may receive (and thus emit) packets from multiple remote hosts or processes. If a server, input packets are sent to the last remote host or process to send a packet to the server. If a client, input packets are sent to the specified address/port/file. For convenience, if a client UDP Socket is configured with a zero IP address, the Socket will send input packets to the destination IP annotation of each packet. If "LOCALIP"/"LOCALPORTNUMBER" or "LOCALFILENAME" is specified, CLIENT is assumed if not set and the specified local address/port/file will be bound before the connection attempt is made. If CLIENT is set to false, any "LOCALIP"/"LOCALPORTNUMBER" and "LOCALFILENAME" arguments are ignored. Socket inputs are agnostic, i.e., they may be either "pull" or "push". If pushed, packets will block on the underlying socket; otherwise, the socket will pull packets as it can accept them. For best performance, place a Notifier element (such as NotifierQueue) upstream of a "pull" Socket. Keyword arguments are:
// A server socket Socket(TCP, 0.0.0.0, 80) -> ... // A client socket ... -> Socket(TCP, 1.2.3.4, 80) // A bi-directional server socket (handles one client at a time) ... -> Socket(TCP, 0.0.0.0, 80) -> ... // A bi-directional client socket ... -> Socket(TCP, 1.2.3.4, 80, CLIENT true) -> ... // A bi-directional client socket bound to a particular local port ... -> Socket(TCP, 1.2.3.4, 80, 0.0.0.0, 54321) -> ... // A localhost server socket allow :: RadixIPLookup(127.0.0.1 0); deny :: RadixIPLookup(0.0.0.0/0 0); allow -> deny -> allow; // (makes the configuration valid) Socket(TCP, 0.0.0.0, 80, ALLOW allow, DENY deny) -> ...
Generated by 'click-elem2man' from '../elements/userlevel/socket.hh' on 24/May/2007.