text: Advanced JAVA: OOP and Networking. Dr. Hong Li*, Dr. Ali Setoodehnia *New York City College of Technology Kean University April 11, 2003. AGENDA:. Introduction to Java Introduction to Java Applets OOP, methods Java Networking. Introduction to JAVA: OOP and Networking
  Dr. Hong Li*, Dr. Ali Setoodehnia
  *New York City College of Technology
  Kean University
  April 11, 2003
  g.drawLine(x, (int)f(x), x + 1, (int)f(x + 1)); } }
  An Example of Applet
  import java.net.*; // .net library
  URL url; //declare url as URL
  url = new URL(location);// create URL object
  AppletContext Browser = getAppletContext();
  browser.showDocument(url); // cause browser to
  // display the url
  Example: View HTML file
  View Code
  Server run
  Waiting for connection
  Read input
  Send output
  Read ..
  ..
  Client connect
  Send output
  Read input
  …
  Close connection
  socket conn = new Socket(serverAddress, port);
  3. Processing phase: Client and server communicate via the InputStream and OutputStream objects.
  4. When transmission is complete, the client closes the connection by invoking the close method on the Socket
  view code run clientrun client