Networking, Web, Java, Monsoon

Networking, Web, Java, Monsoon

Networking, Web, Java, Monsoon ● How do programs on different machines communicate? ➤ Same OS? Different OS? Programming language? ➤ Through browser? Application? Other? ➤ How to programs find out about each other? ● Clients and Servers ➤ The server accepts requests from the client or clients, processes and communicates, centralized (e.g., database), typically one or small number of clients ➤ The client makes requests of the server, potentially LOTS of clients ➤ Possible to have middle-level as well, or proxy server Duke CPS 108 17.1 Low-level communication ● A socket is a two-way pipe that can be opened between programs ➤ Low-level communication, basically byte-at-a-time ➤ Possible to send strings as formatted byte sequence ● Protocol must be explicit between client and server, and protocol is low-level ➤ If string read is this, do that ➤ Expect a string, process it ● Socket uses host address and port number, agreed on by client and server ➤ In Java it’s easy to create a socket, get reader/writer ➤ Can do this in C/C++, write a class to re-use ● See Client.java and Server.java example Duke CPS 108 17.2 Other methods of communication ● Applet – client side program that can talk to server ➤ Applet is Java code downloaded over the web, run in JVM that’s part of browser on the client side ➤ Applet cannot (by default) communicate with client computer, but can communicate back to host/server ➤ Advantages of applets? Drawbacks? ● RMI – remote method invocation ➤ Objects on different machines communicate directly by method calls between objects, just like “regular” programs ➤ Java takes care of turning method calls/parameters into low-level bytes as needed ➤ Client/Server roles mixed, calls go each way ➤ Need lots of infrastructure, Java supplies most of it Duke CPS 108 17.3 Web architectures for client/server ● CGI: Common Gateway Interface ➤ Web server communicates with CGI programs ➤ CGI programs written in any language, web server mediates between the CGI server program and the browser/client ● Typically each CGI request starts a new process ➤ Process is heavyweight (compared to thread), doesn’t scale ➤ FastCGI: shares CGI programs (don’t restart, reuse?), mod_perl, execute CGI scripts/programs in web server ● ASP: Active Server Pages ➤ Combines HTML, scripts, server-side programs (COM) ➤ For practical purposes limited to Windows web servers Duke CPS 108 17.4 Servlets ● Java program that takes HTTP requests, processes them, returns HTTP result ➤ Executes as server-side program, similar to CGI ➤ Doesn’t start new process, executes within JVM as a thread ➤ Benefits from Java security model within JVM ➤ Portable (in theory) to many platforms ➤ In some ways like a server-side applet ● Many libraries available as part of Java and via third parties for extending functionality of Servlets ➤ Need servlet engine that interfaces with Web server ➤ In fourth quarter 99, Apache web server has 60% of market, has Servlet engine as an add on Duke CPS 108 17.5.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us