networking web java monsoon
play

Networking, Web, Java, Monsoon How do programs on different machines - PowerPoint PPT Presentation

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


  1. 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 17.1 Duke CPS 108

  2. 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 17.2 Duke CPS 108

  3. 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 17.3 Duke CPS 108

  4. 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 17.4 Duke CPS 108

  5. 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 17.5 Duke CPS 108

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend