Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

Socket in Linux (Part 18/24)

By Ashish Vara

I explained an  Interprocess communication (i.e. Pipe, named pipe) between two applications or process in system. You  might be wondering if two applications available in different machines over the network (i.e. local PC or server), pipe or named pipe are communicated or not?  Pipe or named pipe can communicate only those processes which are located in the same system. We can communicate with application which is located in different systems through new communication method named Socket.

Socket is the end point of two way communication link between two programs running on network. You can also communicate between two processes through socket on same machine but mostly it is used for communicating over network. Socket is supported by different operating systems like window, MAC, Linux, Unix etc.

Socket is usually interfaced by application programming interface (API) which is provided by operating system. API  allows the program to use network socket and connect with another machine over the network.

Socket is used in server – client model application. Server is the process which responds upon request from client (i.e. local user PC). Socket is an end point communication of two applications. It is created on both sides of client and server for communicating together. Socket communicates over network by IP address and port number. IP address is numerical value assigned to each computer and device which uses the internet protocol for communication. Port is way to identify specific process to which an internet or other network message is forwarded when it arrives at server. There are different types of sockets. Stream socket is used for TCP connection and datagram socket is used for UDP connection. I will also explain server – client model for understanding how  does socket work with server – client model.

Server – Client model

Server-client model is the communication model for sharing the resource and provide the service to different machines. Server is the main system which provides resources and different kinds of services when client requests to use it.

Server – client model is communicated by Secure Socket Layer (SSL). SSL is computer networking protocol that manages server authentication. SSL provides the public and symmetric keys for secure communication between two machines over the internet like web, mail server or client PC or machine.

Overview of Server-Client Model

Fig. 1:Overview of Server-Client Model

Server Side

Server  listens to the client request from different clients. Upon accepting the request, the server  creates a socket for new client request. Socket creates by binding the port and address of client in server side. Server waits for sending response to client and then sends the response  to accept the connection. After connection, server and client both are  able to share data.

Overview of Server-Client Communication

Fig. 2: Overview of Server-Client Communication

Client Side

Client  can also bind the local port number and address which is used during communication. It sends the request to server. After that, client will wait and receive the response from server. Now client is able to transfer data with server. Server closes the socket and disconnects the connection with client if timeout  occurrs.

Transmission Protocols of Socket

There are basically two transmission protocols supported by socket:

1)      TCP/IP

2)      UDP

TCP/IP

TCP/IP (Transmission Control Protocol) is connection oriented protocol. Message or data is transferred from one computer to another over the internet. TCP is heavy weight protocol. It provides flow of data control,  acknowledgment, guarantee of arrived of message and error checking.

UDP

UDP (User Datagram Protocol) is connection less protocol. It also transfers the message or data from one computer to another with end point connection relation which means it is not connection oriented like TCP/IP rather a light weight protocol and faster than TCP/IP. It does not provide acknowledgement, flow of data control and guarantee  for the arrival of message.

We can create the socket in Linux and also develop the client server model using TCP/IP or UDP protocol. I will explain how to create socket and socket ( ) system call in the next tutorial. 


Filed Under: Tutorials

 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)
  • Driving High Side MOSFET using Bootstrap Circuitry – (Part 17/17)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • New automotive radar sensor enables reliable in-cabin monitoring system
  • TI breaks ground on 300-mm semiconductor wafer-fabrication plants in Texas
  • New wireless AR Smart Viewer reference design
  • Infineon launches scalable and wireless charging platform with configurable controllers
  • First single-core MPU with MIPI CSI-2 camera interface and audio

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Resistor across crystal for biasing the internal op-amp
  • A circuit that can adjust a resistance and probing a voltage node
  • MOSFET ORing circuit simulation (LTspice)
  • MOSFET current control
  • MAX2771 digital output processing

RSS Electro-Tech-Online.com Discussions

  • Multistage BJT amplifier
  • Ampro 16mm Stylist projector woes.
  • Need help using a common power supply for two devices
  • NXP i.MX8 board vs Raspberry Pi?
  • Help me to start 24V BLDC (Star winding)
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering