Unix Socket Tutorial

January 3, 2020 0

Sockets are communication points on the same or different computers to exchange data. Sockets are supported by Unix, Windows, Mac, and many other operating systems. The tutorial provides a strong foundation by covering basic topics […]

What is a Socket?

January 3, 2020 0

Sockets allow communication between two different processes on the same or different machines. To be more precise, it’s a way to talk to other computers using standard Unix file descriptors. In Unix, every I/O action […]

Unix Socket – Network Addresses

January 3, 2020 0

Before we proceed with the actual stuff, let us discuss a bit about the Network Addresses − the IP Address. The IP host address, or more commonly just IP address, is used to identify hosts […]

Unix Socket – Network Host Names

January 3, 2020 0

Host names in terms of numbers are difficult to remember and hence they are termed by ordinary names such as Takshila or Nalanda. We write software applications to find out the dotted IP address corresponding […]

Unix Socket – Client Server Model

January 3, 2020 0

Most of the Net Applications use the Client-Server architecture, which refers to two processes or two applications that communicate with each other to exchange some information. One of the two processes acts as a client […]

Unix Socket – Structures

January 3, 2020 0

Various structures are used in Unix Socket Programming to hold information about the address and port, and other information. Most socket functions require a pointer to a socket address structure as an argument. Structures defined […]

Unix Socket – Network Byte Orders

January 3, 2020 0

Unfortunately, not all computers store the bytes that comprise a multibyte value in the same order. Consider a 16-bit internet that is made up of 2 bytes. There are two ways to store this value. […]

Unix Socket – IP Address Functions

January 3, 2020 0

Unix provides various function calls to help you manipulate IP addresses. These functions convert Internet addresses between ASCII strings (what humans prefer to use) and network byte ordered binary values (values that are stored in […]

Unix Socket – Core Functions

January 3, 2020 0

This chapter describes the core socket functions required to write a complete TCP client and server. The following diagram shows the complete Client and Server interaction −   The socket Function To perform network I/O, […]

Unix Socket – Helper Functions

January 3, 2020 0

This chapter describes all the helper functions, which are used while doing socket programming. Other helper functions are described in the chapters −Ports and Services, and Network Byte Orders. The write Function The write function attempts to write nbyte bytes […]

Unix Socket – Server Examples

January 3, 2020 0

To make a process a TCP server, you need to follow the steps given below − Create a socket with the socket() system call. Bind the socket to an address using the bind() system call. For a server socket […]

Unix Socket – Client Examples

January 3, 2020 0

To make a process a TCP client, you need to follow the steps given below &minus ; Create a socket with the socket() system call. Connect the socket to the address of the server using the connect() system call. […]

Unix Socket – Summary

January 3, 2020 0

Here is a list of all the functions related to socket programming. Port and Service Functions Unix provides the following functions to fetch service name from the /etc/services file. struct servent *getservbyname(char *name, char *proto) […]