Server:
Step 1: Start
Step 2: create a socket with address family AEINET, type SOCK_STERAM and default protocol.
Step 3: Initialize the socket and set its attributes.
Step 4: Bind the server to socket using bind function.
Step 5: wait for the client request on request establish a connection using accept() function.
Step 6: Read the source and destination files names from the client.
Step 7: Open the source and destination files.
Step 8: Read one line of source file and send it to client.
Step 9: Receive the line back from the client.
Step 10: Repeat steps 8&9 until the end of the source file.
Step 11: close the source and destination files.
Step 12: close the connection and goto step5.
Client:
Step 1: start
Step 2: Create a socket with address family AEINET type SOCK_STREAM and default protocol.
Step 3: Initialize the socket and set its attribute set required port no.
Step 4: Connect to server using connect () function to initiate the request.
Step 5: send the source and destination file names to server.
Step 6: Recive the string from the server and print it at the console.
Step 7: send the string to the server.
Step 8: Repeat step6&7 until the server terminates and connection.
Step 9: stop.
C Program To Implement File Transfer Protocol
|