CS158a
Chris Pollett
Feb. 1, 2023
import java.io.*; import java.net.*;
ServerSocket server = new ServerSocket(SERVERPORT); Socket socket;this might throw an exception if someone else is already bound to ServerPort.
socket = server.accept();which could be used to set up one connection with a client; typically, one would then spawn a thread.
Socket socket = new Socket("www.cs.sjsu.edu", SERVERPORT);
Make a small Java program using Sockets that connects to port 80 of "www.cs.sjsu.edu". It then writes:
GET / HTTP/1.1 Host:www.cs.sjsu.edu
followed by two carriage return, linefeeds.
It listens for and receives and prints to the System.out, the first 100 characters received, before closing the connection.
Please post your solution to the Feb 1 In-Class Exercise Thread.
So we could define total latency as:
Latency = Propagation + Transmit + Queue Propagation = Distance/SpeedOfLight (will be different if looking at general propagation delay) Transmit = Size/Bandwidth
50 × 10^-3 × 45 × 10^6 bits/sec = 2.25 × 10^6 bits ≈ 280KB.
Throughput = TransferSize/TransferTime TransferTime = RTT + TransferSize/Bandwidth