Академический Документы
Профессиональный Документы
Культура Документы
2.5SOCKETINTERFACEPROGRAMMING
2.5SOCKETINTERFACEPROGRAMMING
Socket: End point of an inter-process communication flow across a computer network.
Different types of sockets :
Stream socket :(connection- oriented socket)
It provides reliable, connected networking service
Error free; no out- of- order packets (uses TCP)
applications: telnet, http,
Datagram socket :(connectionless socket)
It provides unreliable, best- effort networking service
Packets may be lost; may arrive out of order (uses UDP)
applications: streaming audio/ video
It is capable of neither sending nor receiving data. The socket just acts as a
reference or a label.
The buffers and necessary variables are created inside the operating system.
2.5.1 (continued)
Header Files
Family : Defines family protocol(how to interpret the addresses and port number) ,PF_INET
,PF_INET6.
Type : Defines four types of sockets.
SOCK_STREAM (for TCP)
SOCK_DGRAM( for UDP)
SOCK_SEQPACKET (for SCTP)
SOCK_RAW( for application that directly use the services of IP)
Protocol : (defines specific protocol, set to 0 for TCP/IP)
Local Socket Address: Defines local socket address. Socket Address is itself made of the length
field , family field(set to the constant AF_INET for TCP/IP), port number(which defines the
process) and IP address field(which defines the host on which the process is running) . Also
contains an unused field.
Remote Socket Address: Define the remote socket address. Structure is the same as the local
socket address.
10
11
12
13
14
2
Create
5
Create
15
16
17
18
19
2.19
20
2.20
21
2.21
22
2.22
23
24
ThankYou.
25