Operating systems and network hardware drivers contain mechanisms that are used by sockets in order to allow applications to communicate. Socket programming is a complex process that involves many aspects, but before learning more about it, you must understand what a socket is.
A socket is a very important technology which is used in computer networking. Although network software can be seen as a new phenomenon, sockets appeared almost two decades ago. These days, as software applications continue to grow, sockets seem to have more and more use because software packages like Web browsers, peer to peer file sharing systems and messaging applications are based on them. Therefore they are very reliable technologies.
The process of sending and receiving data over a network while using a set of APIs is called socket programming. The socket APIs first appeared on the BSD PD, but now you can find them on Linux, Unix, Mac Os and Windows. A socket can also be referred to as an end point through which information can be received from and sent to. The socket API futures some fundamental functions which help the user to achieve all his tasks without encountering any type of problems. This will help you learn more about socket programming:
• It creates a socket which must have a specified type and a protocol bind;
• It must assign an address and a local name to the socket. Usually, in the IP protocol, it creates a port connect and an IP address.
• It relates a socket to a point listen and to a remote.
• It prepares the socket for accepting the incoming connection.
• It accepts the connection and it returns a new socket for communication.
• It sends information to the specified point and remote, and it receives data after the connection has been established.
• It gets and sets the value for a certain option of the socket.
Sockets are bidirectional, which means both sides of the connection are capable of receiving and sending data. However, the application that starts the communication is called the client, while the other application is termed as the server. Still, this terminology might get the users confused in certain systems, so it should be avoided as much as possible. The connection that exists between two software drivers is known as a socket in a nutshell. More than two Web browsers can simultaneously communicate with a single Web server in distributed systems.