Home > Store

Advanced Java Networking, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Advanced Java Networking, 2nd Edition

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale




  • Copyright 2000
  • Edition: 2nd
  • Premium Website
  • ISBN-10: 0-13-084466-7
  • ISBN-13: 978-0-13-084466-8

Super-charged network solutions for experienced Java professionals, updated to Java 2

  • Create powerful client/server applications with RMI
  • Use IDL to build CORBA applications that work with legacy systems
  • Interface with databases using JDBC and SQL
  • Completely updated from the best-selling first edition
  • The latest in Java: JDBC, JINI, JMAPI, IDL, and CORBA
  • Up-to-date networking: TCP/IP, RMI, sockets
  • Application servers, Web servers, and servlets
  • Directory Services, LDAP, and JNDI
  • Advances in Java security

Java remains the language of choice for building Internet and networked applications. In this completely updated second edition of the 1997 best seller, Dick Steflik and Prashant Sridharan bring you tips on the hottest new developments in Java and its family of technologies. For seasoned programmers who need to stay current on Java for network applications, this is the book with the answers.

Java is the first programming language created with the Internet in mind, and this book shows you how it optimizes networked applications with such architectural elements as multithreading, serialization, and I/O. Step-by-step implementations take you through the creation of Java solutions for client/server and Internet environments, using the latest releases of each API. Advanced Java Networking, Second Edition gives you the newest techniques to use with:

  • Servlets for dynamic Web content
  • JavaBeans to create plug-and-play software components
  • JMAPI for centralized management of Java objects

If you are a manager considering networked Java applications, you will find everything you need to understand the scope and possibilities of the project. If you are a professional Java software developer or engineer, you can't afford to miss the essential resources in Advanced Java Networking, Second Edition.

About the CD-ROM

Free CD is packed with live sample code to get you up to speed fast.

Sample Content

Downloadable Sample Chapter

Click here for a sample chapter for this book: 0130844667.pdf

Table of Contents

(NOTE: All chapters conclude with a Summary.)


1. Advanced Java.

Basic Java. Object-Oriented Design Using Java. Applying Good Object-Oriented Design Skills. OOP-Strong, Efficient, and Effective. Java I/O Routines. Streams. The Java Core System. Files. The Abstract Window Toolkit and Swing Classes. I/O in Short. Introduction to Threading in Java. What Are Threads? Threading in Java. Thread Summary. Object Serialization. What Is Serialization? Handling Object Relationships. The Output Streams. Handling Object Webs. Reading Objects. Security and Fingerprinting. Serialization Overview. Performance. Performance Issues. Summary of Performance Issues. A First Look at Java Networking in Action. Pulling It All Together.

2. TCP/IP Fundamentals.

In the Beginning? The Protocol Stack. The OSI Stack. The TCP/IP Stack. IP Addresses. Protocols. DNS. HTTP. CORBA and IIOP. RMI. JINI.

3. Java Sockets and URLs.

Sockets and Interprocess Communication. Introduction to IPC. URL and URL Connection. Summary of Sockets. Client/Server Methodology. The Pizza Order Protocol (TPOP). The TPOP Server. Server Methodology. Setting Up the Server. Initializing the Server Socket. Creating the Thread. Detecting Information and Starting the Thread. Gathering Information. The TPOP Client. Developing Clients for Servers. Clients and Servers in Short. UDP Client. Datagrams. Creating a UDP Sender. Featured Application. Messaging Format. Client. Server.

4. Java Database Connectivity.

Inside JDBC. Database Drivers. JDBC in General. Databases and SQL. Creating an Access Database. Simple SQL. Summary. Retrieving Information. Creating the User Interface. Database Security. Using the JDBC Driver. Creating Queries. Database and SQL Overview. Storing Information. Creating the Connection. Forming a Statement. A JDBC Version of the Featured App. Creating the Database. Mapping the Network Module to Database Queries. Developing the Client. Establishing the Connection. Making an SQL Invocation. Invoking SQL to Make a Change. Shutting Down the Connection.

5. Java RMI: Remote Method Invocation.

Distributed Objects. What Is RMI? How Does RMI Work? Local vs. Remote Objects. Applet vs. Application. Dynamic Method Invocations. Overview of RMI. Client. RMI Client Methodology. Catching Exceptions. Handling Security Constraints. Client Overview. Server. RMI Server Classes. Creating a Server Interface. Implementing a Server. RMI Registry Classes. RMI Server Security Constraints. Generating Stubs and Skeletons. Server Overview. Callbacks. Why Callbacks? Creating the Callback. Implementing the Callback Client. Filling in the Callback Method. Registering Callbacks. Invoking Callbacks. Callbacks in Short. A Java RMI Version of the Featured App. RMI Interface. RMI Client. RMI Server. New in JDK 1.2. Activatable Objects. Custom Socket Factories.

6. Java IDL: Interface Definition Language.

CORBA. CORBA-Style Communication. The CORBA Vision. Communication with CORBA. Separation of Interface and Implementation. Different Vendors, Different ORBs. Advantages of CORBA. Common Object Services. Object Administration. Clients and Servers and Networks, Oh My! What CORBA Means for You. The Interface Definition Language. Interfaces. Modules. Interface Inheritance. Variables and Structures. Methods. Constructed Data Types. Exceptions. Overview of the IDL. Language Mappings. What Exactly Are Language Mappings? The Sun Microsystems Java Language Mapping. Interfaces, Modules, and Methods. Interface Inheritance. Variables and Structures. Constructed Data Types. Exceptions. Java and CORBA Together. CORBA Clients. Designing a User Interface. Defining the Problem. The Cooler Interface Definition. The Cooler User Interface. Initializing the Client ORB. Client Overview. CORBA Servers. Defining an Interface and Generating Code. Server Overview. CORBA Callbacks. Java Callbacks. Creating a Callback. Registering a Callback. Receiving and Handling a Callback. A Java IDL Version of the Featured App. Server Interface. NetworkModule. Calendar Server.

7. Web Servers, Server-Side Java, and More.

Inside an HTTP Server. Web Server Architecture. The HTTP Protocol. Using a Web Server. Advanced Web Server Features. HTTP Server Overview. Common Gateway Interface and CGI Scripts. Servlets. What Is a Servlet? Servlets Overview. Dynamic Documents. Creating the Servlet. A Servlet Version of the Featured App. doGet( ). getAppointments( ). newAppointmentForm( ). insertNewAppointment( ). Java Server Pages. Microsoft Active Server Pages (ASP). PHP. Allaire Cold Fusion. On to JSP. Scriptlets and Expression Evaluation. The Featured Application as a JSP. Dynamic Documents Overview. Multipurpose Servers.

8. Java Beans.

Component Models. The Competition. Overview of the Java Beans Component Model. Interface Publishing. Event Handling. Persistence. Layout. Builder Support. Distributed Beans. Why Use Beans? Java Beans. Component Interaction. Network Communication. User Interface Issues. Persistence. Events. Properties. Beans in a Nutshell. Making a Bean. Using Java Beans. Creating a Java Beans Application. A Simple Example. Instantiating Components. Connecting Beans Events. Bean Introspection. Server-Side Java Beans. Enterprise Java Beans. Summary. COM/DCOM and ActiveX. What Is ActiveX? ActiveX Controls. ActiveX and Java. Java Native Interface (JNI).

9. Application Servers.

High-Performance Web Servers. Integrated Development Environment. Interfacing to Enterprise Resource Planning Systems. Ability to Interface with Transaction Processing Monitors. Support Stateful Applications. Connection Pooling of Database Connections. Access to Legacy Applications and Legacy Databases. Scalability Through Load Balancing. Automatic Fail- Over. Support of the Enterprise Java Beans Specification.

10. Jini: Sun’s Technology of Impromptu Networks.

Examples of Jini. Where Did Jini Come From? Our Working Jini Example. Basic Jini Concepts: “Discovery, Join, and Lookup Oh My!” Server. Client. Getting Started with Jini. Let’s Get to the Code! Implementing the Jini Server. Implementing the Jini Client. Running the Jini Server. Running the Jini Client. Good References to Get You Started.

11. JMX/JMAPI: Java Management API.

What Is Network Management? Network Management at a Glance. Simple Network Management Protocol. The Unique Management Problems of Java. Network Administration Overview. Modifying Clients for JMAPI. AVM Base Classes. AVM Help Classes. Managed Object Interfaces. Setting Up Notifications. Modifying Servers for JMAPI.

12. What Are Directory Services?

Some Background. Introducing Java Naming Directory Interface. Using the JNDI to Access LDAP-Based Data. Setting up the Airius Directory. The Airius Schema. Connecting. Searching. Adding Persons to the Directory. Modifying Information Already in the Directory. Removing Entries from the Directory. Authentication.

13. Java and Security.

Safety in Java. The Java Security Model. Easy to Use Fine-Grained Access Control. Easy to Configure Security Policy. Easy to Extend Access Control Structure. Easy to Extend Security Checks to Applications. Java Class Security. The Bytecode Verifier. The Class Loader. The Security Manager. Security Problems and Java Security Testing. Encryption. Java Cryptography Extension (JCE). Authentication. Kerberos. Digital Signatures and Public Key Encryption. Secure Sockets Layer. The Government and Security. Export Control. The “Clipper” Controversy.

14. Making an Architectural Decision.

Java Sockets. Flexibility. Simplicity. Java RMI Decisions. RMI Advantages. RMI Disadvantages. Three-Tier Applications in RMI. Java IDL. Advantages of Java IDL. Disadvantages of Java IDL. Java IDL Implementations. Java IDL Is Robust. Java IDL Is Difficult. Java IDL Is Powerful. JDBC. Why JDBC Is Not Enough. JDBC and Java IDL or Java RMI. JDBC Alone. JDBC Overview. Other Java Technologies. When to Use Beans. When to Use Servlets and Java Server Pages. Application Servers.



About the CD-ROM.



By now you've seen all the hype, read all the books, and discovered all the wonders of Java. But most of us still use C++ or C to create our hard-core applications, saving Java for our Web pages or leaving it to HTML jocks to fiddle with. Doing so denies us the opportunity to use a programming language that makes interfacing with a computer infinitely easier, with less frustration and faster results.

Java is much more than "Dancing Dukes" or a programming language for Web pages. It is a strong alternative to the masochistic programming of the past, in which countless months were spent debugging compared to the mere days it took to code the initial concept. Java allows us to spend more time in the conceptual phase of software design, thinking up new and creative ways to bring the vast knowledge of the Internet and its many users to our desktop.

Today, our information, and its steady flow, is garnered from the Internet and the millions of fellow computer users around the world. Up until now, you've no doubt designed programs to interface with that knowledge using C or C++. Java will change all of that. In addition to its ability to create adorable and functional user interfaces quickly and easily is Java's ability to easily connect to the Internet. Java is, after all,the Internet Language.

What This Book Is All About

Advanced Java Networking is designed to present you with a myriad of alternatives to connect your applications to the Internet. It is neither a programming reference nor a marketing brochure. We'll leave that to the geeks and marketeers to battle out. Instead, we wanted to explore each alternative without marketing bias or engineering snobbery.

One part of the engineering community will tell you that sockets are the only true way to communicate information over a network. Another segment will say that Java-only applications relying on Remote Method Invocation (RMI) will solve all your communication problems. Then, of course, there is the Common Object Request Broker Architecture (CORBA) camp. We'll discuss these alternatives, and we will also explore aspects of server-side programming in which we use a Web server as a mechanism to generate dynamic Web pages that can be connected to databases (and just about anything else). We present an honest account of each alternative and guidelines for choosing what's best for your business or programming needs. In addition to the hundreds of lines of sample code we supply to help you start from scratch with Java communication, we place an additional emphasis on migration of your existing desktop-centric applications to an Internet-ready world.

Who Should Read This Book

This book is not for beginning programmers nor is it an introductory Java text. We assume that you have a strong object-oriented programming background, preferably in Java. You should have a strong grasp of such Java fundamentals as how to create a class, how to compile and execute programs on your native system, and how to deploy Java applications. Furthermore, you should understand a good deal of the terminology of the object-oriented world.

How to Read This Book

We've conceived this book in parts, with each part further divided in chapters. Each part addresses one aspect of Internet programming, be it Java Fundamentals; Core Networking such as RMI, CORBA, or Java Database Connectivity (JDBC); Advanced Networking like Beans and Web Servers; general Java Networking information, including a special chapter on Internet security that addresses simple Applet Security restrictions; or more complex subjects such as Directory Services and JNDI. We have also included a short chapter that is an introduction to TCP/IP and how the Internet works. I have found this invaluable as the very first thing that we cover in the Internet Programming course I teach.

Finally, we want to show you that Java programming is much more than an animation floating by a Web page or interactive Internet content. Java is a language that can hold its own in the world of desktop applications and the examples in the book typically are written as applications rather than as applets. We make no effort to contain our enthusiasm for Java and certainly don't apologize for our delight in working with it. We hope that you will come to love this language as much as we have.

Fixes and Updates

We would also like to take a moment to apologize in advance for any errors. This book has been a total blast to write, and we might have gotten caught up in our own excitement here and there. In any event, we hope you have fun reading about and exploring the Java networked world!

The CD-ROM that accompanies this book (see "About the CD-ROM," at the back of the book for details regarding the CD-ROM) contains several of the applications that we have developed in this book. Additionally, a special Web page has been created as a front-end to navigating the CD-ROM and for linking to related Web sites. To access that Web page, please load the file named index.html, found in the root directory of the CD-ROM, into your browser.

To err is human, and the authors of this book are as human as can be. Despite testing every example thoroughly, both from an installation and compilation perspective, problems can occur. If we find a problem with any of the programming examples in this book, we will post a fix as soon as possible on our Web site:


This online Web supplement can also be linked to from the Web page included on the CD-ROM included with this book.

Thanks a Million!

About the time that Prashant Sridharan wrote the first edition of this book, I started teaching an undergraduate course titled (innocently enough) Internet Programming (CS-328). My personal goals for the course were that it would be Java based and that it would cover TCP/IP, sockets programming, the use of databases, and distributed object programming. In 1997, there were textbooks on networking and textbooks on Java, but there were no textbooks on networking using Java. I found Prashant's book in the trade book section of our local bookstore. Topically, it was almost a perfect fit for the course outline that I had developed. CS-328 began in the fall of 1997, with Prashant's book as its text. The course has been immensely popular and has been offered to a full house of juniors and seniors every semester since.

Writing the second edition of this book has been a balancing act that has been frustrating at times; rewarding in the support of colleagues, friends, and family; and-to see one's efforts in print-quite satisfying. I had never had the slightest desire to tackle the task of authoring a book, especially a technology-based book. As an adjunct faculty member in the Computer Science Department in the T. J. Watson School of Engineering and Applied Science at Binghamton University (State University of New York) for the last 25 years, I have taught many different programming courses and used texts by many authors, from many sources. I found that, after using the same textbook for several semesters, I would have collected a list of corrections and suggestions for improvements and updates in order to keep the course material current.

After four semesters (two years—a long time in the life of Java) with the first edition, I decided that the material in the book was getting a little stale. After all, Java had progressed to JDK 1.1.7 and the examples in the book were still JDK 1.0. Many of the predictions made about the course that Java would take had not materialized. The book cried out for a second edition. Like any good instructor, I phoned the publisher and eventually was put in touch with Mark Taub. I asked Mark when the second edition would be out and was told that he wished that he could tell me: Prashant no longer worked for Sun and had taken a new job at Microsoft (now there's a defection for you) and didn't have the time required for a second edition. Mark then did something I never expected and asked innocently, "You seem to know what the book needs and you've been using it for quite a while, would you be interested in tackling the second edition?"

After much soul searching and discussion with my wife and my associates in academia, Les Lander, Margaret Iwobi, and Eileene Head, I called Mark back. I told Mark that despite my doubts, my associates thought that it would be a good opportunity for growth (and what else did I have to do with my time?). Conveniently, they seemed to forget that I work fulltime as an Advisory Programmer at Lockheed Martin Federal Systems, Owego, New York, where I am also the site Webmaster.

It has been a busy 10 months since my first contact with Mark. I've really had fun doing this and am really grateful to Mark and Prentice Hall for giving me the opportunity to investigate and write about Java Networking (one of my favorite topics). I'm grateful, too, for the help Anne Trowbridge of Prentice Hall gave me with the CD-ROM that accompanies the book.

There are a number of people that I must credit for their help with getting this book to market. First and foremost is my wife, Bobbie, to whom I have been married for 32 years. She has patiently supported me through more projects than I care to count.

I owe special thanks to associates at Lockheed Martin: first to my manager MaryLou Marcotte for letting me divvy up last year's vacation in the strange way that I did to complete the writing. MaryLou, It's hard adjusting to a normal schedule again.

Scott Rush, our site electronic security guru helped me with the chapter on Java security.

My very special thanks go to Noah Ternullo. Noah is both a work associate and one our graduate students at the university. CS-328 is an undergraduate course; however, because it is an Internet-based course, it attracts a lot of graduate students. Graduate students wanting to take CS-328 must register for Independent Study, successfully complete the course, and do an additional research project in a mutually agreed upon topic in Java networking. They present their project (along with a paper) to the class at the end of the semester. At the time Noah was a graduate student in my class, Sun had just announced JINI, and he decided that that was what he wanted to research. The night that Noah did the class presentation, he and a friend dragged three PCs into the classroom from their cars and set everything up. One machine was running Linux; another, NT; and the third, W95. The presentation was not only a great demonstration of Java portability, but a really good demonstration of JINI. I was so impressed that I invited Noah to write the chapter on JINI. I hope that his contribution to this text will help him fulfill his dreams for entering a doctoral program.

Special thanks also go to my course assistant for CS-328, Edwin Chiu. Edwin has been with me through five semesters and has now earned his bachelor's degree and is currently applying to graduate schools. Edwin tackled the conversion of the Internet Appointment Calendar from Joe to the Visibroker Orb.

Additional thanks go to Peter DeAngelis of Lockheed Martin for coming to our aid when it looked like Visibroker had gotten the best of us and to Elaine Murray for her review of the general information part of the CORBA chapter.

Last, but not least I owe a real debt to the production team from BooksCraft: Don MacLaren, Bill Hartman, and Sara Black. Without Don gently reminding me of production schedules we wouldn't be at this point.

Finally, let us not forget Prashant Sridharan. I owe Prashant the greatest thanks both for writing an excellent first edition and then for changing jobs so that I could write the second edition. Much of what Prashant wrote in the first edition is still included, still applicable.

We, Prashant and I, both had a lot of fun bringing this book to you. We hope that you'll find it as useful as we found it fun.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership