The Server

Interaction operators winsock for systems that are not connection-oriented, it is shown in Figure 5. Here, as in the case connection-oriented, the server calls socket and bind, after which refers to the procedure of recvfrom (rather than read or recv). The client program in this scheme refers to the operator bind and does not use the operator connect (after the preliminary connection is not needed). To send requests and receive responses here are the operators sendto and recvfrom, respectively. In addition to the already described operators to work with connectors (sockets), there is one – select, often used by servers. Select statement allows a process to track the status of one or more connectors.

For each connector, the caller can request information about the status of the read, write or error. Form of address has the form: R = select (num_of_socks, read_socks, write_socks, error_socks, max_time), where num_of_socks – the number of controlled connectors (in some implementations are not used and is optional, by default, this number should not exceed 64). In the version of Berkeley read_socks, write_socks and error_socks represent a bitwise mask defining the type of connector. Read_socks parameter is a pointer to a structure that describes a set of connectors, whose state is controlled by the ability to read (version winsock). If the connector is able to listen, it will be marked like tt for chteniyapri provided that the connection request has been received. This involves the implementation of the operator accept without blocking. For other connectors otovnost to chteniyuodrazumevaet presence in the queue read requests.