SlideShare a Scribd company logo
1 of 24
SOCKET PROGRAMMING
DISTRIBUTED SYSTEMS AND COMPUTER COMMUNICATIONS
ILGIN KAVAKLIOĞULLARI
CSE - 273213005
WHAT IS SOCKET?
A network socket is an endpoint of a connection in a
computer network. In Internet Protocol (IP) networks,
these are often called Internet sockets. It is a handle
(abstract reference) that a program can pass to the
networking application programming interface (API) to
use the connection for receiving and sending data.
Sockets are often represented internally as integers.
WHAT IS SOCKET?
A socket API is an application programming interface,
usually provided by the operating system, that allows
application programs to control and use network sockets.
Internet socket APIs are usually based on the Berkeley
sockets standard. In the Berkeley sockets standard, sockets
are a form of file descriptor (a file handle), due to the Unix
philosophy that "everything is a file", and the analogies
between sockets and files. Both have functions to read,
write, open, and close.
WHAT IS SOCKET?
A socket address is the combination of an IP address and a
port number, much like one end of a telephone connection is
the combination of a phone number and a particular
extension. Sockets need not have an address, for example,
for only sending data, but if a program binds a socket to an
address, the socket can be used to receive data sent to that
address. Based on this address, Internet sockets deliver
incoming data packets to the appropriate application process
or thread.
DEFINITION
An Internet socket is characterized by at least the following:
• Local socket address, consisting of the local IP address
and a port number
• Protocol: A transport protocol, e.g., TCP, UDP, raw IP. This
means that TCP port 53 and UDP port 53 are distinct
sockets.
A socket that has been connected to another socket, e.g.,
during the establishment of a TCP connection, also has a
remote socket address.
TCP: Transmission Control Protocol / UDP: User Datagram
Protocol
DEFINITION
Client Server
DEFINITION
Within the operating system and the application that
created a socket, a socket is referred to by a unique
integer value called a socket descriptor. The operating
system forwards the payload of incoming IP packets to
the corresponding application by extracting the socket
address information from the IP and transport protocol
headers and stripping the headers from the application
data.
DEFINITION
In IETF Request for Comments, Internet Standards, in many
textbooks, as well as in this article, the term socket refers to an
entity that is uniquely identified by the socket number. In other
textbooks, the term socket refers to a local socket address, i.e. a
"combination of an IP address and a port number". In the original
definition of socket given in RFC 147, as it was related to the ARPA
network in 1971, "the socket is specified as a 32 bit number with
even sockets identifying receiving sockets and odd sockets
identifying sending sockets." Today, however, socket
communications are bidirectional.
On Unix-like operating systems and Microsoft Windows, the
command line tools netstat and ss are used to list established
sockets and related information.
IETF: Internet Engineering Task Force / ARPA: Advanced Research Projects Agency
TYPES OF SOCKETS
Several types of Internet socket are available:
• Stream sockets, also known as connection-oriented sockets,
which use Transmission Control Protocol (TCP), Stream Control
Transmission Protocol (SCTP) or Datagram Congestion Control
Protocol (DCCP).
App
socket
3 2 1
Dest.
TYPES OF SOCKETS
• Datagram sockets, also known as connectionless
sockets, which use User Datagram Protocol (UDP).
App
socket
3 2 1
D1
D3
D2
TYPES OF SOCKETS
• Raw sockets (or Raw IP sockets), typically available
in routers and other network equipment. Here the
transport layer is bypassed, and the packet headers
are made accessible to the application.
• Other socket types are implemented over other
transport protocols, such as Systems Network
Architecture (SNA).
SOCKET STATES IN THE CLIENT-
SERVER MODEL
Computer processes that provide application services are referred
to as servers, and create sockets on start up that are in listening
state. These sockets are waiting for initiatives from client
programs.
A TCP server may serve several clients concurrently, by creating a
child process for each client and establishing a TCP connection
between the child process and the client. Unique dedicated
sockets are created for each connection. These are in established
state when a socket-to-socket virtual connection or virtual circuit
(VC), also known as a TCP session, is established with the remote
socket, providing a duplex byte stream.
SOCKET STATES IN THE CLIENT-
SERVER MODEL
A server may create several concurrently established TCP
sockets with the same local port number and local IP
address, each mapped to its own server-child process,
serving its own client process. They are treated as different
sockets by the operating system, since the remote socket
address (the client IP address and/or port number) are
different; i.e. since they have different socket pair tuples.
SOCKET STATES IN THE CLIENT-
SERVER MODEL
A UDP socket cannot be in an established state, since UDP
is connectionless. Therefore, netstat does not show the state
of a UDP socket. A UDP server does not create new child
processes for every concurrently served client, but the same
process handles incoming data packets from all remote
clients sequentially through the same socket. It implies that
UDP sockets are not identified by the remote address, but
only by the local address, although each message has an
associated remote address.
SOCKET PAIRS
Communicating local and remote sockets are called socket
pairs. Each socket pair is described by a unique 4-tuple
consisting of source and destination IP addresses and port
numbers, i.e. of local and remote socket addresses. As seen
in the discussion above, in the TCP case, each unique
socket pair 4-tuple is assigned a socket number, while in the
UDP case, each unique local socket address is assigned a
socket number.
IMPLEMENTATIONS
Sockets are usually implemented by an application
programming interface (API) library. Most implementations
are based on Berkeley sockets, for example Winsock
introduced in 1991. Other API implementations exist, such
as the STREAMS-based Transport Layer Interface (TLI).
Development of application programs that utilize this API is
called socket programming or network programming.
IMPLEMENTATIONS
• In 1983, Berkeley sockets, also known as the BSD socket API,
originated with the 4.2BSD Unix operating system (released in
1983) as an API. Only in 1989, however, could UC Berkeley
release versions of its operating system and networking library
free from the licensing constraints of AT&T's copyright-protected
Unix.
• In 1987, the Transport Layer Interface (TLI) was the networking
application programming interface provided by AT&T UNIX
System V Release 3 (SVR3). and continued into Release 4
(SVR4).
• Other early implementations were written for TOPS-20, MVS,
VM, IBM-DOS (PCIP).
MY SOCKET CHAT APPLICATION
My application consists of two parts.
• Server
• Client
Explanations are in the codes.
This program coded with C# language.
SERVER
Libraries
CLIENT
Libraries
OUTPUT OF CODES
Socket Programming w/ C# - IK

More Related Content

What's hot (18)

Application Layer Functionality and Protocols
Application Layer Functionality and ProtocolsApplication Layer Functionality and Protocols
Application Layer Functionality and Protocols
 
Internet protocols
Internet protocolsInternet protocols
Internet protocols
 
Basic networking course
Basic networking courseBasic networking course
Basic networking course
 
Networking
NetworkingNetworking
Networking
 
OSI layers
OSI layersOSI layers
OSI layers
 
Mod5
Mod5Mod5
Mod5
 
What is TCP/IP
What is TCP/IPWhat is TCP/IP
What is TCP/IP
 
Novell Netware Protocol suite
Novell Netware Protocol suiteNovell Netware Protocol suite
Novell Netware Protocol suite
 
TCPIP
TCPIPTCPIP
TCPIP
 
Chapter 2.1 : Data Stream
Chapter 2.1 : Data StreamChapter 2.1 : Data Stream
Chapter 2.1 : Data Stream
 
Socket programming
Socket programmingSocket programming
Socket programming
 
TCP/IP Basics
TCP/IP BasicsTCP/IP Basics
TCP/IP Basics
 
Internet Protocols
Internet ProtocolsInternet Protocols
Internet Protocols
 
Tcp
TcpTcp
Tcp
 
TCP/IP Presentation
TCP/IP PresentationTCP/IP Presentation
TCP/IP Presentation
 
IPC SOCKET
IPC SOCKETIPC SOCKET
IPC SOCKET
 
Socket programming
Socket programmingSocket programming
Socket programming
 
Tcp ip tutorial
Tcp ip tutorialTcp ip tutorial
Tcp ip tutorial
 

Similar to Socket Programming w/ C# - IK

Similar to Socket Programming w/ C# - IK (20)

Application programming interface sockets
Application programming interface socketsApplication programming interface sockets
Application programming interface sockets
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04
 
Network Programming-Python-13-8-2023.pptx
Network Programming-Python-13-8-2023.pptxNetwork Programming-Python-13-8-2023.pptx
Network Programming-Python-13-8-2023.pptx
 
Socket programming
Socket programmingSocket programming
Socket programming
 
Socket Programming by Rajkumar Buyya
Socket Programming by Rajkumar BuyyaSocket Programming by Rajkumar Buyya
Socket Programming by Rajkumar Buyya
 
BASIC TO ADVANCED NETWORKING TUTORIALS
BASIC TO ADVANCED NETWORKING TUTORIALSBASIC TO ADVANCED NETWORKING TUTORIALS
BASIC TO ADVANCED NETWORKING TUTORIALS
 
Final networks lab manual
Final networks lab manualFinal networks lab manual
Final networks lab manual
 
Socket programming
Socket programming Socket programming
Socket programming
 
Cloud Presentation.pdf
Cloud Presentation.pdfCloud Presentation.pdf
Cloud Presentation.pdf
 
Python networking
Python networkingPython networking
Python networking
 
Internetbasics
InternetbasicsInternetbasics
Internetbasics
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat application
 
Lecture 2 -_understanding_networks_with_presenter_notes
Lecture 2 -_understanding_networks_with_presenter_notesLecture 2 -_understanding_networks_with_presenter_notes
Lecture 2 -_understanding_networks_with_presenter_notes
 
Tcp
TcpTcp
Tcp
 
Ip sec
Ip secIp sec
Ip sec
 
Network Sockets
Network SocketsNetwork Sockets
Network Sockets
 
Sockets
Sockets Sockets
Sockets
 
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriyaIPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
 
A.java
A.javaA.java
A.java
 
Md13 networking
Md13 networkingMd13 networking
Md13 networking
 

More from Ilgın Kavaklıoğulları (11)

Multi-Core on Chip Architecture *doc - IK
Multi-Core on Chip Architecture *doc - IKMulti-Core on Chip Architecture *doc - IK
Multi-Core on Chip Architecture *doc - IK
 
Unified Parallel C - IK
Unified Parallel C - IKUnified Parallel C - IK
Unified Parallel C - IK
 
Computational Genomics - Bioinformatics - IK
Computational Genomics - Bioinformatics - IKComputational Genomics - Bioinformatics - IK
Computational Genomics - Bioinformatics - IK
 
Database Security - IK
Database Security - IKDatabase Security - IK
Database Security - IK
 
Normal Mapping / Computer Graphics - IK
Normal Mapping / Computer Graphics - IKNormal Mapping / Computer Graphics - IK
Normal Mapping / Computer Graphics - IK
 
Agent-Based Technologies (Mobile-C) - IK
Agent-Based Technologies (Mobile-C) - IKAgent-Based Technologies (Mobile-C) - IK
Agent-Based Technologies (Mobile-C) - IK
 
Internet of Things (IoT) - IK
Internet of Things (IoT) - IKInternet of Things (IoT) - IK
Internet of Things (IoT) - IK
 
Travelling Salesman Problem using Partical Swarm Optimization
Travelling Salesman Problem using Partical Swarm OptimizationTravelling Salesman Problem using Partical Swarm Optimization
Travelling Salesman Problem using Partical Swarm Optimization
 
Robotics - IK
Robotics - IKRobotics - IK
Robotics - IK
 
Expert Systems - IK
Expert Systems - IKExpert Systems - IK
Expert Systems - IK
 
Business Intelligent Systems - IK
Business Intelligent Systems - IKBusiness Intelligent Systems - IK
Business Intelligent Systems - IK
 

Recently uploaded

Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 

Recently uploaded (20)

Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 

Socket Programming w/ C# - IK

  • 1. SOCKET PROGRAMMING DISTRIBUTED SYSTEMS AND COMPUTER COMMUNICATIONS ILGIN KAVAKLIOĞULLARI CSE - 273213005
  • 2. WHAT IS SOCKET? A network socket is an endpoint of a connection in a computer network. In Internet Protocol (IP) networks, these are often called Internet sockets. It is a handle (abstract reference) that a program can pass to the networking application programming interface (API) to use the connection for receiving and sending data. Sockets are often represented internally as integers.
  • 3. WHAT IS SOCKET? A socket API is an application programming interface, usually provided by the operating system, that allows application programs to control and use network sockets. Internet socket APIs are usually based on the Berkeley sockets standard. In the Berkeley sockets standard, sockets are a form of file descriptor (a file handle), due to the Unix philosophy that "everything is a file", and the analogies between sockets and files. Both have functions to read, write, open, and close.
  • 4. WHAT IS SOCKET? A socket address is the combination of an IP address and a port number, much like one end of a telephone connection is the combination of a phone number and a particular extension. Sockets need not have an address, for example, for only sending data, but if a program binds a socket to an address, the socket can be used to receive data sent to that address. Based on this address, Internet sockets deliver incoming data packets to the appropriate application process or thread.
  • 5. DEFINITION An Internet socket is characterized by at least the following: • Local socket address, consisting of the local IP address and a port number • Protocol: A transport protocol, e.g., TCP, UDP, raw IP. This means that TCP port 53 and UDP port 53 are distinct sockets. A socket that has been connected to another socket, e.g., during the establishment of a TCP connection, also has a remote socket address. TCP: Transmission Control Protocol / UDP: User Datagram Protocol
  • 7. DEFINITION Within the operating system and the application that created a socket, a socket is referred to by a unique integer value called a socket descriptor. The operating system forwards the payload of incoming IP packets to the corresponding application by extracting the socket address information from the IP and transport protocol headers and stripping the headers from the application data.
  • 8. DEFINITION In IETF Request for Comments, Internet Standards, in many textbooks, as well as in this article, the term socket refers to an entity that is uniquely identified by the socket number. In other textbooks, the term socket refers to a local socket address, i.e. a "combination of an IP address and a port number". In the original definition of socket given in RFC 147, as it was related to the ARPA network in 1971, "the socket is specified as a 32 bit number with even sockets identifying receiving sockets and odd sockets identifying sending sockets." Today, however, socket communications are bidirectional. On Unix-like operating systems and Microsoft Windows, the command line tools netstat and ss are used to list established sockets and related information. IETF: Internet Engineering Task Force / ARPA: Advanced Research Projects Agency
  • 9. TYPES OF SOCKETS Several types of Internet socket are available: • Stream sockets, also known as connection-oriented sockets, which use Transmission Control Protocol (TCP), Stream Control Transmission Protocol (SCTP) or Datagram Congestion Control Protocol (DCCP). App socket 3 2 1 Dest.
  • 10. TYPES OF SOCKETS • Datagram sockets, also known as connectionless sockets, which use User Datagram Protocol (UDP). App socket 3 2 1 D1 D3 D2
  • 11. TYPES OF SOCKETS • Raw sockets (or Raw IP sockets), typically available in routers and other network equipment. Here the transport layer is bypassed, and the packet headers are made accessible to the application. • Other socket types are implemented over other transport protocols, such as Systems Network Architecture (SNA).
  • 12. SOCKET STATES IN THE CLIENT- SERVER MODEL Computer processes that provide application services are referred to as servers, and create sockets on start up that are in listening state. These sockets are waiting for initiatives from client programs. A TCP server may serve several clients concurrently, by creating a child process for each client and establishing a TCP connection between the child process and the client. Unique dedicated sockets are created for each connection. These are in established state when a socket-to-socket virtual connection or virtual circuit (VC), also known as a TCP session, is established with the remote socket, providing a duplex byte stream.
  • 13. SOCKET STATES IN THE CLIENT- SERVER MODEL A server may create several concurrently established TCP sockets with the same local port number and local IP address, each mapped to its own server-child process, serving its own client process. They are treated as different sockets by the operating system, since the remote socket address (the client IP address and/or port number) are different; i.e. since they have different socket pair tuples.
  • 14. SOCKET STATES IN THE CLIENT- SERVER MODEL A UDP socket cannot be in an established state, since UDP is connectionless. Therefore, netstat does not show the state of a UDP socket. A UDP server does not create new child processes for every concurrently served client, but the same process handles incoming data packets from all remote clients sequentially through the same socket. It implies that UDP sockets are not identified by the remote address, but only by the local address, although each message has an associated remote address.
  • 15. SOCKET PAIRS Communicating local and remote sockets are called socket pairs. Each socket pair is described by a unique 4-tuple consisting of source and destination IP addresses and port numbers, i.e. of local and remote socket addresses. As seen in the discussion above, in the TCP case, each unique socket pair 4-tuple is assigned a socket number, while in the UDP case, each unique local socket address is assigned a socket number.
  • 16. IMPLEMENTATIONS Sockets are usually implemented by an application programming interface (API) library. Most implementations are based on Berkeley sockets, for example Winsock introduced in 1991. Other API implementations exist, such as the STREAMS-based Transport Layer Interface (TLI). Development of application programs that utilize this API is called socket programming or network programming.
  • 17. IMPLEMENTATIONS • In 1983, Berkeley sockets, also known as the BSD socket API, originated with the 4.2BSD Unix operating system (released in 1983) as an API. Only in 1989, however, could UC Berkeley release versions of its operating system and networking library free from the licensing constraints of AT&T's copyright-protected Unix. • In 1987, the Transport Layer Interface (TLI) was the networking application programming interface provided by AT&T UNIX System V Release 3 (SVR3). and continued into Release 4 (SVR4). • Other early implementations were written for TOPS-20, MVS, VM, IBM-DOS (PCIP).
  • 18. MY SOCKET CHAT APPLICATION My application consists of two parts. • Server • Client Explanations are in the codes. This program coded with C# language.
  • 20.
  • 22.