Java Reference
In-Depth Information
Chapter 16. Server-Side Java
Introduction
Sockets form the underpinnings of almost all networking protocols. JDBC, RMI, CORBA,
EJB, and the non-Java RPC (Remote Procedure Call) and NFS (Network File System) are all
implemented by connecting various types of sockets together. Socket connections can be im-
plemented in most any language, not just Java: C, C++, Perl, and Python are also popular,
and many others are possible. A client or server written in any one of these languages can
communicate with its opposite written in any of the other languages. Therefore, it's worth
taking a quick look at how the ServerSocket behaves, even if you wind up utilizing the
higher-level services such as RMI, JDBC, CORBA, or EJB.
The discussion looks first at the ServerSocket itself, then at writing data over a socket in
various ways. Finally, I show a complete implementation of a usable network server written
in Java: the chat server from the client in the previous chapter.
TIP
Most production work in server-side Java uses the Java Enterprise Edition (Java EE). Java
EE provides scalability and support for building well-structured, multi-tiered distributed
applications. EE provides the “servlet” framework; a servlet is a strategy object that can
be installed into any standard Java EE web server. EE also provides two web “view” tech-
nologies: the original JSP (JavaServer Pages) and the newer, component-based JSF
(JavaServer Faces). Finally, EE provides a number of other network-based services, in-
cluding EJB3 remote access and Java Messaging Service (JMS). These are unfortunately
outside the scope of this topic, and are covered in several other books such as Arun
Gupta's Java EE 7 Essentials: Enterprise Developer Handbook . This chapter is only for
those who need or want to build their own server from the ground up.
Search WWH ::




Custom Search