Socket programming
A?socket?is a communications connection point (endpoint) that you can name and address in a network. Socket programming shows how to use socket APIs to establish communication links between remote and local processes.
The processes that use a socket can reside on the same system or different systems on different networks. Sockets are useful for both stand-alone and network applications. Sockets allow you to exchange information between processes on the same machine or across a network, distribute work to the most efficient machine, and they easily allow access to centralized data. Socket application program interfaces (APIs) are the network standard for TCP/IP. A wide range of operating systems support socket APIs. i5/OS sockets support multiple transport and networking protocols. Socket system functions and the socket network functions are threadsafe.
Programmers who use Integrated Language Environment? (ILE) C can refer to this topic collection to develop socket applications. You can also code to the sockets API from other ILE languages, such as RPG.
Socket Programming?is a method to connect two nodes over a network to establish a means of communication between those two nodes. A?node?represents a computer or a physical device with an internet connection. A?socket?is the endpoint used for connecting to a node. The signals required to implement the connection between two nodes are sent and received using the sockets on each node respectively.
领英推荐
Stages for Server
Different stages must be performed on the server node to receive a connection sent by the client node. These stages are discussed elaborately in this section.
A. Socket Creation
The first stage deals with the creation of a socket, which is the basic component for sending or receiving signals between nodes. The?sys/socket.h?header has the necessary functions to create a socket in C. In socket programming in C, a socket can be created by the?socket()?function with syntax,
The?domain?represents the address family over which the communication will be performed. The domain is pre-fixed values present in the?sys/socket.h?header. Some domains are,