0% found this document useful (0 votes)
28 views

S6 Networking Lab Algo

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

S6 Networking Lab Algo

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

(NEXT UDP) UDP ALGORITHM (NEXT -LEAKY BUCKET) (NEXT -CONGESTION CONTROL)

TCP ALGORITHM SERVER SELECTIVE REPEAT ALGORITHM: FORK()


1. start 1. start 1. Start the program 1. Declare a variable x to be
2. declare the variables for the 2. declare the variables for the 2. Generate a random that gives shared by both child.
socket socket the total no. of frames to be 2. create a child using fork()
3. specify the family, protocol, ip 3. specify the family, protocol, ip transmitted. system call
address, and port number address, and port number 3. Set the size of the window. 3. if return value is greater than
4. create a socket using socket () 4. create a socket using socket () 4. Generate a random no. less than 0, then a) print “Parent Process”
function function or equal to the Size of the current b) print process id of the parent
5. bind the ip address and port 5. bind the ip address and port window and identify the no. of using getpid
number number frames to be transmitted at a given 4. if return value is not greater
6. listen and accept the client is 6. listen and accept the client is time. than 0, then, a) print “child
reqst for the connection reqst for the connection 5. Transmit the frames and receive process” b) print process id of
7. read the client’s message 7. read and display the client’s the acknowledgement for the child using get pid.
8. display the client’s message message frames sent. 5. stop
9. continue the chat 8. stop 6. Find the remaining frames to be WAIT()
10. terminate the chat CLIENT sent. 1. create a child process using
11. close the socket 1. start 7. Find the current window size. fork system call
12. stop 2. declare the variables for the 8. If an acknowledgement is not 2. if return value is -1, then
CLIENT socket received for a particular frame, a)print “Process Creation
1. start 3. specify the family, protocol, ip retransmit that frame alone again. unsuccessful”
2. declare the variables for the address, and port number 9. Repeat the steps 4 to 8 till the 3. Terminate using exit system
socket 4. create a socket using socket () no. of remaining frames to be send call 4. If return value is greater
3. specify the family, protocol, ip function becomes zero. than 0, then, a) Suspend parent
address, and port number 5. call the connect () function 10. Stop the program. process until child b) print
4. create a socket using socket () 6. read the input message “Parent starts” c) print even
function 7. send the input message to the LEAKY BUCKET ALGORITHM number from 0-10 d) print
5. call the connect () function server 1. Start “Parent ends”
6. read the input message 8. display the server’s echo 2. Set the bucket size or the buffer 5. If return value is 0 then, a)
7. send the input message to the 9. close the socket size. print “Child Starts” b) print odd
server 10. stop 3. Set the output rate. numbers from 0-10 c) print child
8. display the server’s display 4. Transmit the packets such that ends
9. continue the chat there is no overflow. 6. stop
10. terminate the chat 5. Repeat the process of EXEC()
11. close the socket transmission until all packets are 1. create a file named exec.c
12. stop transmitted. (Reject packets where 2. in exec file, display a
its size is greater than the bucket statement 3. compile and create
(NEXT -DISTANCE VECTOR) DISTANCE VECTOR ROUTING size) an executable file of exec.c
FTP ALGORITHM ALGORITHM 6.Stop 4. Create a new file execabc.c
SERVER 1. a route transmit its distance 5. In executable file use execup
1. start vector to each of its neighbours command using the following
GO BACK N ALGORITHM: Server 1.
2. declare the variables for the in a routing packet syntax where file points to file
Start
socket 2. each router receives and saves name associated with the file. Int
2. Establish connection
3. specify the family, protocol, the most recently received execup (const char*file,
(recommended UDP)
ip address, and port number distance vector from each of its char*args[])
3.Accept the window size from the
4. create a socket using socket () neighbours 6. By exec command, execabc file
client (should be <=40)
function 3. a router recalculate its is replaced with execfile
4. Accept the packets from the
5. bind the ip address and port distance: 7. Execute the program
network layer.
number - it receives a distance vector 8. stop
5. Calculate the total frames
6. listen and accept the client is from a neighbour containing
/windows required. Congestion control
reqst for the connection different information than
6. Send the details to the client 1. Start
7. establish connection with the before
(total packets, total frames) 2. Set the bucket size or the
client - it discover that a link to a
7. Initialise the transmit buffer buffer size.
8. close the socket neighbour has gone down
8. Built the frame / window 3. Set the output rate.
9. stop
depending on the window size. 4. Transmit the packets such that
CLIENT The distance vector calculation is
9. Transmit the frame there is no overflow.
1. start based on minimizing the cost to
10. Wait for the acknowledgement 5. Repeat the process of
2. declare the variables for the each destination
frame transmission until all packets are
socket Dx(y)= estimate of least cost
11. Check for the transmitted. (Reject packets
3. specify the family, protocol, from x to y
acknowledgement of each packet where its size is greater than the
ip address, and port number C(x,v)= node x knows cost to
and repeat the process from the bucket size)
4. create a socket using socket () each neighbour y
packet for which the first negative 6. Stop
function
acknowledgement is received. Else
5. call the connect () function
Continue as usual. 12. Increment
6. stop
the frame count and repeat steps 7
(NEXT -LINK STATE) LINK STATE ROUTING
to 12 until all packets. are
STOP AND WAIT From the Source n to every
transmitted
1.Start other node in the network.
13. Close the Connection
2. Generate a random number P(V): Cost of the least path from
14. Stop
that gives the total number of the Source node V as If their
Client
frames to be transmitted. iteration of the algorithm.
1. Start
3. Transmit the first frame. P(V): Previous node of v along
2. Establish connection
4. Receive the acknowledgement Path from the Current least cost.
(recommended UDP)
for the first frame. Path from the source to V
3.Send the window size on server
5. Transmit the next frame. N: Subset of nodes V is in N if the
request
6. Find the remaining frames to least cost Path from the Source
4. Accept the details from the
be sent. to V is definetly known.
Server (total packets, total frames).
7.If a acknowledgement is not Initialisation
5. Initialise the receive buffer with
received for a particular frame, N = {U}
the expected packets.
retransmit that frame alone For all nodes V
6. Accept the frame / window from
again. if v is a neighbour of u
the server.
8. Repeat the step 5 to 7 till the then D(V) = C (U,V)
7. Check for validity of the packets
number of remaining frames to else
and construct the
be sent become zero. D(V) = α
acknowledgement frame
9. Stop the program do {
depending on the validity. (Here
Find W N' Such that D(w) is a
the acknowledgement is accepted
minimum odd to W to N’
from the users).
Update D(V) for each neighbour
8. Depending on the
V of W and net in N'
acknowledgement frame readjust
n(V) = min { D(V), D(W) + c (w, v)
the process.
}
9. Increment the frame count and
repeat steps5-9 until all packets are
received.
10. Close the connection.
11. Stop

You might also like