+
Agenda
Java Socket
Interactive Socket Server Lifecycle
Lifecycle of a multithreaded socket server
Use Case Diagram
Class Diagram
Socket Server Operations
WeatherSocketServer.java
Socket Client Operation
Socket Server Demo
Socket Clients Demo
+
Java Socket
A socket is a communication end point
Is a network programming interface
Is used by a process to communicate with a remote system via a
transport protocol.
Needs an IP address and a port number
Sockets are popularly used in client/server computing
Provides two major types of services:
Connection-oriented
Connectionless
+
Java Socket – cont.
Java supports client/server computing using sockets.
Java supports both connection-oriented and connectionless
services.
Java uses Socket for clients and ServerSocket for servers in
a connection-oriented environment.
Java uses DatagramSocket/DatagramPacket for connectionless
services.
+
Interactive Socket Server Lifecycle
+
Lifecycle of a multithreaded socket
server
+
Use Case Diagram
+
Class Diagram
+
Socket Server Operations
+
WeatherSocketServer.java
+
WeatherSocketServer.java
+
+
Socket Client Operation
+
Socket Client
+
Socket Server Demo
Client1’s request
Client2’s request
+
Socket Clients Demo
Client1 request for Taipei’s weather condition
Client1 request for TaoYuan’s weather condition