Download - TCP file upload server client example
![Page 1: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/1.jpg)
1
Socket programming with TCP
For server and client Huma Chaudhry
ME111012Nima bahrami ME101004
Huma Chaudhry(ME111012), Nima Bahrami(ME101004)
![Page 2: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/2.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 2
Stream: Listen: Server does
the Listening at a port for you
Port: 65535 ports Socket: a door
between application process and end-end-transport protocol (UCP or TCP)
Try-Catch
Some Important Terms:
a host-local, application-created,
OS-controlled interface (a “door”) into which
application process can both send and
receive messages to/from another
application process
socket
![Page 3: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/3.jpg)
Overview of Client/Server interaction TCP
Huma Chaudhry(ME111012), Nima Bahrami(ME101004)
3
wait for incomingconnection requestconnectionSocket =welcomeSocket.accept()
create socket,port=xyz, forincoming request:
welcomeSocket = ServerSocket()
create socket,connect to hostid, port=x
clientSocket = Socket()
closeconnectionSocket
read reply fromclientSocket
Close reqclientSocket
send request usingclientSocketread request from
connectionSocket
write reply toconnectionSocket
TCP connection setup
![Page 4: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/4.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 4
process
TCP withbuffers,
variables
socket
controlled byapplicationdeveloper
controlled byoperating
system
host orserver
process
TCP withbuffers,
variables
socket
controlled byapplicationdeveloper
controlled byoperatingsystem
host orserver
internet
![Page 5: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/5.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 5
Networking:
![Page 6: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/6.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 6
Server Side
Client Side
Sneak Peak into the Code
![Page 7: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/7.jpg)
7
Socket programming (server)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004)
Passive Listening:
![Page 8: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/8.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 8
Socket programming (server)Streams of Data to carry data to/from Client:
![Page 9: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/9.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 9
Socket programming (server)
Receiving File from Client:
![Page 10: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/10.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 10
Socket programming (server)
Client Terminating Connection:
![Page 11: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/11.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 11
Socket programming (server)
Server Terminating Connection:
![Page 12: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/12.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 12
Client Request for Connection:-
![Page 13: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/13.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 13
Socket programming: ClientClient reaching out to Server
![Page 14: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/14.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 14
Client Communication with Server:
![Page 15: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/15.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 15
![Page 16: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/16.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 16
Client Side:Client Sending File
![Page 17: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/17.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 17
Client Closing Connection:
![Page 18: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/18.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 18
Thanks to TCP
![Page 19: TCP file upload server client example](https://reader036.vdocument.in/reader036/viewer/2022062419/558d28bed8b42aab2a8b45a4/html5/thumbnails/19.jpg)
Huma Chaudhry(ME111012), Nima Bahrami(ME101004) 19
Thank you for Bearing with us through the code and discussion
Any queries, Please?