Explanation Of Socket Programming for Computer Networking

Explanation Of Socket Programming for Computer Networking

A socket is the fundamental technology of computer network programming. Sockets give permission to network software applications to communicate using standard mechanisms built into network hardware and operating systems.

Although it's like just another feature of Internet software development, socket technology existed long before the Web. And, many of today's most popular network software applications rely on sockets.

Explanation Of Socket Programming for Computer Networking
Explanation Of Socket Programming for Computer Networking

What Sockets Can Do For Your Network

A socket represents a point-to-point connection between two pieces of software. More than two pieces of software can communicate with server/client or distributed systems by using multiple sockets. For example, many Web browsers can simultaneously communicate with a single Web server through a group of sockets made on the server.

Socket-based software generally runs on two separate computers on the network, but sockets can also be used to communicate locally (interprocess) on a single computer. Sockets are bidirectional, meaning that either side of the connection is capable of both sending and receiving data. Sometimes the one application that initiates communication is termed the "client" and the other application the "server," but this terminology leads to confusion in peer to peer networking and should generally be avoided.

Socket Application Programming Interfaces and Libraries

Several libraries that implement standard application programming interfaces exist on the Internet. The first mainstream package - the Berkeley Socket Library is still widely in use on UNIX systems. Another very common application program interface is the Windows Sockets (WinSock) library for Microsoft operating systems. Relative to other computer technologies, socket APIs are quite mature: WinSock has been in use since 1993 and Berkeley sockets since 1982.

The socket APIs are relatively small and simple. Many of the functions are similar to those used in file input/output routines such as <tt>read()</tt>, <tt>write()</tt>, and <tt>close()</tt>. The actual function calls to use depend on the programming language and socket library chosen.

Types Of Socket Interface

Socket interfaces can be divided into three categories:

  • Stream sockets, the most common type, requires that the two communicating parties first establish a socket connection, after which any data passed through that connection will be guaranteed to arrive in the same order in which it was sent - so-called connection-oriented programming model.
  • Datagram sockets offer "connection-less" semantics. With datagrams, connections are implicit rather than explicit as with streams. Either party simply sends datagrams as needed and waits for the other to respond; messages can be lost in transmission or received out of order, but it is the application's responsibility and not the sockets to deal with these problems. Implementing datagram sockets can give some applications a performance boost and additional flexibility compared to using stream sockets, justifying their use in some situations.
  • The third type of socket -- the raw socket -- bypasses the library's built-in support for standard protocols like Transmission Control Protocol and User Datagram Protocol. Raw sockets are used for custom low-level protocol development.

Explain Socket Support in Network Protocols

Modern network sockets are typically used in conjunction with the Internet protocols -- IP, TCP (Transmission Control Protocol), and UDP (User Datagram Protocol). Libraries implementing sockets for Internet Protocol use Transmission Control Protocol for streams, User Datagram Protocol for datagrams, and Internet protocols itself for raw sockets.

To communicate over the Internet, IP socket libraries use the IP address to identify specific computers. Many parts of the Internet work with naming services, so that the users and socket programmers can work with computers by name (e.g., "computer.wireless.redbuddy.in") instead of by address (e.g., Stream and datagram sockets also use IP port numbers to distinguish multiple applications from each other. For example, Web browsers on the Internet know to use port 80 as the default for socket communications with Web servers.

Explanation Of Socket Programming for Computer Networking Explanation Of Socket Programming for Computer Networking Reviewed by Redbuddy on April 19, 2019 Rating: 5

No comments :

Powered by Blogger.