Generic Connection Framework Connection Input Connection Output Connection
- Slides: 27
Generic Connection Framework Connection Input. Connection Output. Connection Stream. Connection File. Connection Socket. Connection HTTPConnection
Generic Connection Framework Connection Input. Connection void close() Output. Connection Stream. Connection File. Connection Socket. Connection HTTPConnection
Generic Connection Framework Connection DIS open. Data. Input. Stream() DIS open. Input. Stream() Input. Connection void close() DOS open. Data. Output. Stream() DOS open. Output. Stream() Output. Connection Stream. Connection File. Connection Socket. Connection HTTPConnection
Generic Connection Framework Connection DIS open. Data. Input. Stream() DIS open. Input. Stream() Input. Connection void close() DOS open. Data. Output. Stream() DOS open. Output. Stream() Output. Connection Stream. Connection File. Connection Socket. Connection String get. Address() String get. Local. Address() int get. Local. Port() int get. Port() HTTPConnection
Socket Communication q Sockets provide an abstraction of two-point communication q The two sides only read/write without concern for how data is translated (encoded) and transmitted
Socket Communication q Sockets provide an abstraction of two-point communication q The two sides only read/write without concern for how data is translated (encoded) and transmitted q Socket is a pair (address, port) Ø address: www. google. com, turing. cc. gettysburg. edu, 135. 24. 78. 123 Ø port: 21 (ftp), 22 (ssh), 23 (telnet), 80 (http), 101 (pop mail)
Socket Communication server (turing. cc. gettysburg. edu) client (135. 24. 78. 123) web server listens on port 80
Socket Communication server (turing. cc. gettysburg. edu) request web page client (135. 24. 78. 123) turing. cc…: 80 socket 135. 24. 78. 123: 1234 web server listens on port 80
Socket Communication server (turing. cc. gettysburg. edu) request web page client (135. 24. 78. 123) turing. cc…: 80 socket 135. 24. 78. 123: 1234 accept request socket tuing. cc…. . : 5789 web server listens on port 80
Socket Communication server (turing. cc. gettysburg. edu) client (135. 24. 78. 123) socket tuing. cc…. . : 5789 web server listens on port 80 socket 135. 24. 78. 123: 1234
Socket Communication server (turing. cc. gettysburg. edu) client (135. 24. 78. 123) socket tuing. cc…. . : 5789 socket 135. 24. 78. 123: 1234 request web page web server listens on port 80 client (135. 24. 78. 567) turing. cc…: 80 socket 135. 24. 78. 567: 1024
Socket Communication server (turing. cc. gettysburg. edu) client (135. 24. 78. 123) socket tuing. cc…. . : 5789 socket 135. 24. 78. 123: 1234 request web page web server listens on port 80 client (135. 24. 78. 567) turing. cc…: 80 socket 135. 24. 78. 567: 1024 accept request socket tuing. cc…. . : 8019
Socket Communication server (turing. cc. gettysburg. edu) client (135. 24. 78. 123) socket tuing. cc…. . : 5789 socket 135. 24. 78. 123: 1234 client (135. 24. 78. 567) web server listens on port 80 socket tuing. cc…. . : 8019 socket 135. 24. 78. 567: 1024
Simple Server (one client) 1. Open the Server Socket 2. Wait for Client Request 3. Create Streams for Communication 4. Carry Out Communication 5. Close Communication
Simple Server (one client) 1. Open the Server Socket 1. Server. Socket server = new Server. Socket(5678); 2. Wait for Client Request 1. 3. Create Streams for Communication 4. Carry Out Communication 5. Close Communication
Simple Server (one client) 1. Open the Server Socket 1. Server. Socket server = new Server. Socket(5678); 2. Wait for Client Request 1. Socket connection = server. accept(); 3. Create Streams for Communication 4. Carry Out Communication 5. Close Communication
Simple Server (one client) 1. Open the Server Socket 1. Server. Socket server = new Server. Socket(5678); 2. Wait for Client Request 1. Socket connection = server. accept(); 3. Create Streams for Communication Output. Stream os = connection. get. Output. Stream(); Data. Output. Stream output = new Data. Output. Stream (os); 4. Carry Out Communication 5. Close Communication
Simple Server (one client) 1. Open the Server Socket 1. Server. Socket server = new Server. Socket(5678); 2. Wait for Client Request 1. Socket connection = server. accept(); 3. Create Streams for Communication Output. Stream os = connection. get. Output. Stream(); Data. Output. Stream output = new Data. Output. Stream (os); 4. Carry Out Communication 1. output. write. UTF("Hi there"); 5. Close Communication
Simple Server (one client) 1. Open the Server Socket 1. Server. Socket server = new Server. Socket(5678); 2. Wait for Client Request 1. Socket connection = server. accept(); 3. Create Streams for Communication Output. Stream os = connection. get. Output. Stream(); Data. Output. Stream output = new Data. Output. Stream (os); 4. Carry Out Communication 1. output. write. UTF("Hi there"); 5. Close Communication output. close(); os. close(); connection. close(); server. close();
Simple Server (one client) public static void main(String[] args) { // Register service on port 1234 Server. Socket server = new Server. Socket(1234); // Wait and accept a connection Socket connection = server. accept(); // Get a communication stream associated with the socket Output. Stream os = connection. get. Output. Stream(); Data. Output. Stream output = new Data. Output. Stream(os); // Send a string! output. write. UTF("Hi there"); // Close the connection output. close(); os. close(); connection. close(); server. close(); }
Simple Client 1. Create a Socket Connection 2. Create Streams for Communication 3. Carry Out Communication 1. 4. Close Communication
Simple Client 1. Create a Socket Connection Socket. Connection connection = (Socket. Connection)Connector. open("socket: //gbcs 10: 123"); 2. Create Streams for Communication 3. Carry Out Communication 4. Close Communication
Simple Client 1. Create a Socket Connection Socket. Connection connection = (Socket. Connection)Connector. open("socket: //gbcs 10: 5678"); 2. Create Streams for Communication Input. Stream is = connection. open. Input. Stream(); Data. Input. Stream input = new Data. Input. Stream(is); 3. Carry Out Communication 4. Close Communication
Simple Client 1. Create a Socket Connection Socket. Connection connection = (Socket. Connection)Connector. open("socket: //gbcs 10: 5678"); 2. Create Streams for Communication Input. Stream is = connection. open. Input. Stream(); Data. Input. Stream input = new Data. Input. Stream(is); 3. Carry Out Communication String data = new String (input. read. UTF()); 4. Close Communication
Simple Client 1. Create a Socket Connection Socket. Connection connection = (Socket. Connection)Connector. open("socket: //gbcs 10: 5678"); 2. Create Streams for Communication Input. Stream is = connection. open. Input. Stream(); Data. Input. Stream input = new Data. Input. Stream(is); 3. Carry Out Communication String data = new String (input. read. UTF()); 4. Close Communication is. close(); input. close(); connection. close();
Simple Client try { Socket. Connection connection = (Socket. Connection) Connector. open("socket: //gbcs 10: 1234"); Input. Stream is = connection. open. Input. Stream(); Data. Input. Stream input = new Data. Input. Stream(is); String data = new String (input. read. UTF()); is. close(); input. close(); connection. close(); } catch (. . . ) { }
Lab Exercise Client-Server Communication
- Title with scope and limitation
- Communication planning modeling construction deployment
- Terry hill framework operations strategy
- Generic framework of e commerce
- Generic framework of e commerce
- A generic process framework for software engineering
- Is a laser printer input or output
- What is output in algorithm?
- Hitunglah koefisien masukan dan keluaran setiap sektor
- Getch vs getchar
- Scanner input or output
- Java file input and output
- Digitizer input or output
- Output mouse
- And operation
- Computer input devices drawing
- Output
- Foramen interventriculare
- Input process output
- Input-output channels in hci
- Input device dan output device
- Specialized input devices
- Plotter is input or output device
- Vr input
- Little man program
- Diagram hipo
- Input and output of krebs cycle
- Counting primitive operations examples