Please enable JavaScript.
Coggle requires JavaScript to display documents.
The Client-Server Application with UDP - Coggle Diagram
The Client-Server Application with UDP
Processing Primitive Data in TCP Programming
Type data in java TCP Programming
complex data
array
java collection
object
basic
boolean
String
char
float
double
int
byte
Step to code Server-Side
Accept request to connection
Process the request
Listen to request for connection continuously
Respond to client when necessary
bind to a port
Step to code Client-side
2, Send request to the server
Accept response from the server
Connect to the remote machine
Process the response
Filter
Filter Stream
Filter Stream
Chaining 1
Filter Classes
Chaining 2
Raw Data
Chaining Filters
Chaining Output Filter Stream
OutputStream os = clientSocket.getOutputStream(); //1.Get output stream from socket
DataOutputStream dos = new DataOutputStream(os); //2. Chaining point - attaching DataOutputStream to OutputStream
dis.writeInt(58); //3.a. DataOutputStream translates int into raw data,bytes, b. OutputStream writes raw data(bytes) into a network socket
Chaining Input Filter Stream
InputStream is = clientSocket.getInputStream(); //1. Get input from socket
DataInputStream dis - new DataInputStream(is); //2.Chaining point - attaching DataInputStream to InputStream
int requestId = dis.readInt(); //3.a) Read raw data(byte) from a network socket, b) DataInputStream translates bytes data into int
Processing Complex Data in TCP Programming
Data Object in TCP Programming
Receiving
Sending
java,io Package
Serializing Object
object extend to serializable interface
Serializable interface : java.io.Serializable
object must be serializable write onto a stream
interface automates process storing and retrieving objects and arrays from streams
Steps to Serialize Object
Extend class definition to interface Serializable
Complete class definition
Define a class
Steps to code for server-side
Process the request
Respond to client when necessary
Accept request to connection
Listen to request for connection continuously
Bind to a port
Steps to code for client-side
Send request to the server
Accept response from the server
Connect to the remote machine
Process the response
Introduction to UDP(User Data Protocol)
Retransmission not happen for loss damage data during transmission
Cheap effort, Low overhead protocol
Designed for unreliable transmission data
Rearrange not happen for packet out of order
Programming UPD with java
Important classes(java.net)
DatagramSocket
DatagramPacket
InetAddress