Introduction to Network Programing - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Introduction to Network Programing

Description:

Information Tracking : Keeps track of State information such as ... Accept : Answer the Phon. TCP( Cont.) MSS. Window. Transmit {max. Seg. Size. that TCP ready ... – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 15
Provided by: tgto
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Network Programing


1
Introduction to Network Programing
  • TCP Duties
  • infor.
  • Tracking

Discarding Duplications



Data Sequ.
Ack. Handling
Flow Control



RTT
2
TCP(Cont.)
  • RTT Round Trip Time(Max. Delay Time).
  • Information Tracking Keeps track of State
    information such as sequence numbers and window
    sizes for each direction of data flow(Send and
    Receive).
  • Data Sequencing Ordering the data segments.
  • Flow Control how many bytes data can be accepted
    from the other peer(advertised window).

3
TCP Three Way handshake( to establish connection)
  • Client Server

Socket Connect
Socket, Bind, Listen
Passive Connection
SYN J
SYN K, Ack. J1
Connect Returns
Ack. K1
Accept Returns
J is Clients Sequence Number, K is Server
Sequence number
4
Network- Telephone Simulation
  • Socket Have a Telephone.
  • Bind Publish the Tel. Number
  • Listen Turn on the ringer to heart.
  • Connect Dialling a number.
  • Accept Answer the Phon.

5
Synchronise
TCP( Cont.)
MSS
Window
Transmit
max. Seg. Size that TCP ready to accept
Max. Seg. Size that TCP ready to advrtise
Time for each advertised or
received Seg. To avoid data corruption
6
Handshake to terminate connections
Active Close
FIN M
Passive Close
Ack. M1
Close
FIN N

Ack N1
7
TCP Socket functions
Server
  • Socket( )

Client
  • Bind( )
  • Listent( )
  • Socket( )
  • accept( )

Connection establised
  • connect( )

Wait for connection
  • read( )

Data request
  • write( )
  • write( )

Data reply
  • read( )
  • read( )

End of data file
  • close( )
  • close( )

8
Sockets
  • Functions
  • Perform network INPUTS/OUTPUTS
  • Specify Address Family (AF_)type.
  • e.g. AF_INET IPV4 Prot.
  • AF_LOCAL Unix Prot.
  • Specify Socket type
  • e.g. Sock_Stream, Sock_DGRAM, SOCK_Raw

9
Sockets(Cont.)
  • Socket Call .
  • include ltsys/socket.hgt
  • int socket((int family, int type, int
    protocol)

10
Connect
  • To establish a connection with TCP.
  • Return 0 if O.K. , -1 otherwise.
  • Algorithm
  • include lt sys / socket.h gt
  • int bind(int sockd, cons struct sockaddr
  • addr, socklen_t addrln)

11
Listen
  • Convert Unconnected Socket to Passive Socket.
  • Specifies the max. number of connections for this
    Socket.
  • Algorithm
  • Void
  • Listen(int fd, int backlog)
  • char ptr
  • if ( ( ptr getenv( LISTENQ)) !
    null)
  • Backlog ATOI(PTR)
  • if(listen(fd, backlog) lt 0)
  • err_sys(listen error))

12
ACCEPT
  • Called by TCP to call next completed connection.
  • Return -1 for error.
  • Algorithm
  • int accept (int sockd , struct sockaddr cliadr,
    socklen_t addrlen)

13
Client-Server Example
  • Dialog Steps
  • Client reads text from its input.
  • Write text to Server.
  • Server Read text from Network
  • Echoes the text back to Client.
  • Client reads the echoed text from Server
  • Print text to output.

14
Client Server Dialog Chart
fgets
writen
readline
TCP Server
TCP Client
fputs
writen
readline
Write a Comment
User Comments (0)
About PowerShow.com