This is the 1st HTML5 slant canvas

KIWY logo depicting a kiwi bird with a candle

k i w y

Need a light for your site?

This is the 2nd HTML5 slant canvas



Working With URLs

Opening a web page with a URL object, from Java

Using Stream Sockets

Stream sockets are used for connection-oriented communication between a client and server


  1. Create a ServerSocket object:
    • The port number identifies the application on the host computer. (web = port 80, for example)
    • queue length = max number of clients that can connect to server
     ServerSocket serv = new ServerSocket(portNumber, queueLength);
  2. Listen for a client connection. Call method accept():
      Socket connection = serv.accept();
  3. Retrieve the OutputStream and InputStream objects associated with the socket:
     OutputStream os = connection.getOutputStream();
     InputStream is = connection.getInputStream();
    If we desire, we can wrap these up in other types of streams:
      ObjectInputStream objIn = new ObjectInputStream(is);	// etc
  4. Process data with the stream objects (like writing to and reading from files)
  5. close the connections by invoking the close() method on the streams and the Socket


  1. Create a socket to connect to the server:
      Socket connection = new Socket(serverAddress, port);
  2. Obtain the socket's InputStream and OutputStream references (like step 3 of server)
  3. Process data
  4. Close the socket

Using Datagram Sockets