SlideShare a Scribd company logo
Compiled by: Jayakumar Balasubramanian Web:  http://www.jwritings.com Email:  [email_address]
Introduction Introduction to sockets The “Endian” concept Trivial functions Socket APIs Client server programming using sockets
Introduction
The “Endian” concept
Big-Endian
Little-Endian
Bit order transformation
Trivial functions
How does one talk to TCP/IP ?
Addressing in IP and TCP
Socket address
Socket APIs
API : Socket () Use to create a socket. fd = socket (family, type, protocol) Family  : AF_INET, AF_UNIX, AF_NS  Type  : SOCK_STREAM, SOCK_DGRAM Protocol  : Protocol for a given socket
API: bind() [The anchor]
API: bind() Attach a transport address to a socket. status = bind (fd, addressp, addrlen); fd  :  Socket descriptor addressp :  Pointer to address structure addrlen  : Size of address structure
API: connect()
API : connect() The connect function is used by a TCP client to establish a connection with a TCP server  int fd, status, addrlen; struct sockaddr  *addressp; status = connect (fd, addresssp, addrlen);
API: listen()
API: listen() listen() Prepares a socket to accept connections Must be used only on the server side of the application before any connection request is accepted. int fd, qlen, status;   status = listen (fd, qlen);  fd  : Socket descriptor  qlen  : Length of the queue
API : accept()
API : accept() Used in the server side of the connection to accept incoming new connections When requests arrives it creates new socket, accepts the connection on the new socket int newfd, addrlen; struct sockaddr  * addressp; newfd = accept (fd, addressp, & addrlen);
Connection establishment
API : send() Sends data over a communication channel Can be used in server and client side   int fd, len, flags;   char *buff;   sent = send (fd, buff, len, flags);   sent can be <= len
API : recv() R eceives data over a communication channel Can be used in server and client side   int fd, len, flags, received;   char *buff; received = recv (fd, buff, len, flags);
API: close() Close terminates both directions of data transfer, reading and writing.  close( sockfd)
Web  :  http://www.jwritings.com Email:  [email_address]

More Related Content

PDF
Network programming Using Python
PDF
Socket Programming
PPTX
Networking in Java
PPTX
Python Sockets
DOC
socket programming
PPT
Networking & Socket Programming In Java
PPTX
Java 1
DOC
Socket
Network programming Using Python
Socket Programming
Networking in Java
Python Sockets
socket programming
Networking & Socket Programming In Java
Java 1
Socket

What's hot (19)

PPT
Application Layer and Socket Programming
PPT
Ppt of socket
PPT
Socket programming-tutorial-sk
PDF
Socket programming-in-python
PDF
Socket programming
PPTX
Socket programming in Java (PPTX)
PPT
Socket programming in C
PDF
Java sockets
PPT
A Short Java Socket Tutorial
PPTX
Java socket programming
PPTX
Network programming in java - PPT
PPT
Java API: java.net.InetAddress
PPT
Socket programming
PDF
Network Sockets
PPT
Basic socket programming
PDF
Java networking programs socket based
PPTX
PYTHON -Chapter 5 NETWORK - MAULIK BORSANIYA
PPTX
Socket programming in c
PDF
Socket programming using java
Application Layer and Socket Programming
Ppt of socket
Socket programming-tutorial-sk
Socket programming-in-python
Socket programming
Socket programming in Java (PPTX)
Socket programming in C
Java sockets
A Short Java Socket Tutorial
Java socket programming
Network programming in java - PPT
Java API: java.net.InetAddress
Socket programming
Network Sockets
Basic socket programming
Java networking programs socket based
PYTHON -Chapter 5 NETWORK - MAULIK BORSANIYA
Socket programming in c
Socket programming using java
Ad

Similar to Networking chapter III (20)

PDF
lab04.pdf
PPT
Sockets
PPT
Sockets intro
PPT
Introduction to sockets tcp ip protocol.ppt
PPT
sockets_intro.ppt
PPT
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
PPTX
Basics of sockets
PPTX
L5-Sockets.pptx
DOC
socket programming
PPTX
Socket Programming
PPT
Sockets in unix
PPT
03-socketprogramming for college students.ppt
PPT
03-socketprogrsamming forcoleeger students.ppt
PDF
Sockets
PDF
Sockets
PDF
Sockets
PPTX
Lecture 1 Socket programming elementary tcp sockets.pptx
PDF
socketProgramming-TCP-and UDP-overview.pdf
PPTX
Socket programming
PPT
Socket System Calls
lab04.pdf
Sockets
Sockets intro
Introduction to sockets tcp ip protocol.ppt
sockets_intro.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
Basics of sockets
L5-Sockets.pptx
socket programming
Socket Programming
Sockets in unix
03-socketprogramming for college students.ppt
03-socketprogrsamming forcoleeger students.ppt
Sockets
Sockets
Sockets
Lecture 1 Socket programming elementary tcp sockets.pptx
socketProgramming-TCP-and UDP-overview.pdf
Socket programming
Socket System Calls
Ad

More from Jayakumar Balasubramanian (12)

PDF
Vegetation of Uttarakhand
PPTX
PPT
Networking chapter VII
PPT
Networking chapter VI
PPT
Networking chapter V
PPT
Networking chapter IV
PPT
Networking chapter II
PPT
ATM Networks - Part I
PPTX
Emotional Intelligence
PPTX
MBTI type indicator
PPT
Performance management primer
PPT
Innovating for emerging markets
Vegetation of Uttarakhand
Networking chapter VII
Networking chapter VI
Networking chapter V
Networking chapter IV
Networking chapter II
ATM Networks - Part I
Emotional Intelligence
MBTI type indicator
Performance management primer
Innovating for emerging markets

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Spectroscopy.pptx food analysis technology
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
 
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
 
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Programs and apps: productivity, graphics, security and other tools
Encapsulation_ Review paper, used for researhc scholars
Spectroscopy.pptx food analysis technology
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
 
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Review of recent advances in non-invasive hemoglobin estimation
The Rise and Fall of 3GPP – Time for a Sabbatical?
 
Per capita expenditure prediction using model stacking based on satellite ima...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MYSQL Presentation for SQL database connectivity
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Dropbox Q2 2025 Financial Results & Investor Presentation
sap open course for s4hana steps from ECC to s4
Programs and apps: productivity, graphics, security and other tools

Networking chapter III

  • 1. Compiled by: Jayakumar Balasubramanian Web: http://www.jwritings.com Email: [email_address]
  • 2. Introduction Introduction to sockets The “Endian” concept Trivial functions Socket APIs Client server programming using sockets
  • 9. How does one talk to TCP/IP ?
  • 10. Addressing in IP and TCP
  • 13. API : Socket () Use to create a socket. fd = socket (family, type, protocol) Family : AF_INET, AF_UNIX, AF_NS Type : SOCK_STREAM, SOCK_DGRAM Protocol : Protocol for a given socket
  • 14. API: bind() [The anchor]
  • 15. API: bind() Attach a transport address to a socket. status = bind (fd, addressp, addrlen); fd : Socket descriptor addressp : Pointer to address structure addrlen : Size of address structure
  • 17. API : connect() The connect function is used by a TCP client to establish a connection with a TCP server int fd, status, addrlen; struct sockaddr *addressp; status = connect (fd, addresssp, addrlen);
  • 19. API: listen() listen() Prepares a socket to accept connections Must be used only on the server side of the application before any connection request is accepted. int fd, qlen, status; status = listen (fd, qlen); fd : Socket descriptor qlen : Length of the queue
  • 21. API : accept() Used in the server side of the connection to accept incoming new connections When requests arrives it creates new socket, accepts the connection on the new socket int newfd, addrlen; struct sockaddr * addressp; newfd = accept (fd, addressp, & addrlen);
  • 23. API : send() Sends data over a communication channel Can be used in server and client side int fd, len, flags; char *buff; sent = send (fd, buff, len, flags); sent can be <= len
  • 24. API : recv() R eceives data over a communication channel Can be used in server and client side int fd, len, flags, received; char *buff; received = recv (fd, buff, len, flags);
  • 25. API: close() Close terminates both directions of data transfer, reading and writing. close( sockfd)
  • 26. Web : http://www.jwritings.com Email: [email_address]