TCPIP Sockets in Java: Practical Guide for Programmers
Description:
Create a TCP socket. Repeatedly: Accept new connection. Communicate. Close ... Create a TCP socket. Bind socket to a port. Set socket to listen. Repeatedly: ... – PowerPoint PPT presentation
Identified by protocol and local/remote address/port
Applications may refer to many sockets
8 Clients and Servers
Client Initiates the connection
Server Passively waits to respond
Server Jane Client Bob Hi, Bob. Im Jane Hi. Im Bob. Nice to meet you, Jane. 9 TCP Client/Server Interaction Server starts by getting ready to receive client connections
Server
Create a TCP socket
Repeatedly
Accept new connection
Communicate
Close the connection
Client
Create a TCP socket
Communicate
Close the connection
10 TCP Client/Server Interaction ServerSocket servSock new ServerSocket(servPo rt)
Server
Create a TCP socket
Repeatedly
Accept new connection
Communicate
Close the connection
Client
Create a TCP socket
Communicate
Close the connection
11 TCP Client/Server Interaction for () Socket clntSock servSock.accept()
Server
Create a TCP socket
Repeatedly
Accept new connection
Communicate
Close the connection
Client
Create a TCP socket
Communicate
Close the connection
12 TCP Client/Server Interaction Server is now blocked waiting for connection from a client
Server
Create a TCP socket
Repeatedly
Accept new connection
Communicate
Close the connection
Client
Create a TCP socket
Communicate
Close the connection
13 TCP Client/Server Interaction Later, a client decides to talk to the server
Server
Create a TCP socket
Repeatedly
Accept new connection
Communicate
Close the connection
Client
Create a TCP socket
Communicate
Close the connection
14 TCP Client/Server Interaction Socket socket new Socket(server, servPort)
Server
Create a TCP socket
Repeatedly
Accept new connection
Communicate
Close the connection
Client
Create a TCP socket
Communicate
Close the connection
15 TCP Client/Server Interaction OutputStream out socket.getOutputStream() out.write(byteBuffer)
PowerShow.com is a leading presentation sharing website. It has millions of presentations already uploaded and available with 1,000s more being uploaded by its users every day. Whatever your area of interest, here you’ll be able to find and view presentations you’ll love and possibly download. And, best of all, it is completely free and easy to use.
You might even have a presentation you’d like to share with others. If so, just upload it to PowerShow.com. We’ll convert it to an HTML5 slideshow that includes all the media types you’ve already added: audio, video, music, pictures, animations and transition effects. Then you can share it with your target audience as well as PowerShow.com’s millions of monthly visitors. And, again, it’s all free.
About the Developers
PowerShow.com is brought to you by CrystalGraphics, the award-winning developer and market-leading publisher of rich-media enhancement products for presentations. Our product offerings include millions of PowerPoint templates, diagrams, animated 3D characters and more.