Network / Socket Programming In LINUX

Network programming also known as Socket programming. Socket is mechanism used in LINUX for one process communicate with another process that is far and through network. There are 2 type of socket which is TCP socket and UDP socket.

What is Socket ?

It is a group of system calls for networking capability which are socket() , bind() , listen() , accept() , connect() , close() and others. Socket are one of the Inter-process communication (IPC) facility for communication between one process with another.

It provides communication between process on CLIENT machine and SERVER on another machines. The 2 most prevalent communication API (Application Program Interface) for UNIX system are Berkely Sockets and System V TLI(Transport Later Interfaces).

Socket are a protocol independent method of creating a connection between process Socket can be either connection based or connection less, packet based or streams based and reliable or unreliable .




Socket are characterized by their domain,type and transport protocol.

Basic Socket System call

  • socket()                                       : To create a socket
  • bind()                                          : To assign a socket with socket address
  • listen()                                         :  Announce willingness to accept a connection
  • accept()                                       : To accept a request
  • connect()                                     : To actively attempt to make a connection
  • send(),sendto(),recv(),recvfrom() : to send and receive data over connection
  • close()                                         : to close socket and release the connection


Comments

Popular posts from this blog

Reading and Writing Operation of SRAM

Transmission Control Protocol (TCP)

File transfer from android to linux