Home > Store

Java Network Programming and Distributed Computing

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

Java Network Programming and Distributed Computing


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


  • Copyright 2002
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 488
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-71037-4
  • ISBN-13: 978-0-201-71037-3

Java's rich, comprehensive networking interfaces make it an ideal platform for building today's networked, Internet-centered applications, components, and Web services. Now, two Java networking experts demystify Java's complex networking API, giving developers practical insight into the key techniques of network development, and providing extensive code examples that show exactly how it's done. David and Michael Reilly begin by reviewing fundamental Internet architecture and TCP/IP protocol concepts all network programmers need to understand, as well as general Java features and techniques that are especially important in network programming, such as exception handling and input/output. Using practical examples, they show how to write clients and servers using UDP and TCP; how to build multithreaded network applications; and how to utilize HTTP and access the Web using Java. The book includes detailed coverage of server-side application development; distributed computing development with RMI and CORBA; and email-enabling applications with the powerful JavaMail API. For all beginning to intermediate Java programmers, network programmers who need to learn to work with Java.

Sample Content

Online Sample Chapter

Transmission Control Protocol and Java

Table of Contents



1. Networking Theory.

What Is a Network?

How Do Networks Communicate?

Communication across Layers.

Advantages of Layering.

Internet Architecture.

Internet Application Protocols.

TCP/IP Protocol Suite Layers.

Security Issues: Firewalls and Proxy Servers.


2. Java Overview.

What Is Java?

The Java Programming Language.

The Java Platform.

The Java Application Program Interface.

Java Networking Considerations.

Applications of Java Network Programming.

Java Language Issues.

System Properties.

Development Tools.


3. Internet Addressing.

Local Area Network Addresses.

Internet Protocol Addresses.

Beyond IP Addresses: The Domain Name System.

Internet Addressing with Java.


4. Data Streams.


How Streams Work.

Filter Streams.

Readers and Writers.

Object Persistence and Object Serialization.


5. User Datagram Protocol.


DatagramPacket Class.

DatagramSocket Class.

Listening for UDP Packets.

Sending UDP Packets.

User Datagram Protocol Example.

Building a UDP Client/Server.

Additional Information on UDP.


6. Transmission Control Protocol.


TCP and the Client/Server Paradigm.

TCP Sockets and Java.

Socket Class.

Creating a TCP Client.

ServerSocket Class.

Creating a TCP Server.

Exception Handling: Socket Specific Exceptions.


7. Multi-threaded Applications.


Multi-threading in Java.


Interthread Communication.

Thread Groups.

Thread Priorities.


8. Implementing Application Protocols.


Application Protocol Specifications.

Application Protocols Implementation.


9. HyperText Transfer Protocol.


HTTP and Java.

The Common Gateway Interface (CGI).


10. Java Servlets.


How Servlets Work.

Using Servlets.

Running Servlets.

Writing a Simple Servlet.


ServletRequest and HttpServletRequest.

ServletResponse and Http Response.



Servlet Exceptions.


HTTP Session Management in Servlets.


11. Remote Method Invocation (RMI).


How Does Remote Method Invocation Work?

Defining an RMI Service Interface.

Implementing an RMI Service Interface.

Creating Stub and Skeleton Classes.

Creating an RMI Server.

Creating an RMI Client.

Running the RMI System.

Remote Method Invocation Packages and Classes.

Remote Method Invocation Deployment Issues.

Using Remote Method Invocation to Implement Callbacks.

Remote Object Activation.


12. Java IDL and CORBA.


Architectural View of CORBA.

Interface Definition Language (IDL).

From IDL to Java.


13. JavaMail.


Installing the JavaMail API.

Testing the JavaMail Installation.

Working with the JavaMail API.

Advanced Messaging with JavaMail.


Index. 0201710374T03292002


Welcome to Java Network Programming and Distributed Computing. The goal of this book is to introduce and explain the basic concepts of networking and discuss the practical aspects of Java network programming.

This book will help readers get up to speed with network programming and employ the techniques learned in software development. If you’ve had some networking experience in another language and want to apply your existing skills to Java, you’ll find the book to be an accelerated guide and a comprehensive reference to the networking API. This book does not require you to be a networking guru, however, as Chapters 1–4 provide a gentle introduction to networking theory, Java, and the most basic elements of the Java networking API. In later chapters, the Java API is covered in greater detail, with a discussion supplementing the documentation that Sun Microsystems provides as a reference.

What You’ll Learn

In this book, readers will learn how to write applications in Java that make use of network programming. The Java API provides many ways to communicate over the Internet, from sending packets and streams of data to employing higher-level application protocols such as HTTP and distributed computing mechanisms.Along the way, you’ll read about:

  • How the Internet works, its architecture and the TCP/IP protocol stack
  • The Java programming language, including a refresher course on topics such as exception handling
  • Java’s input/output system and how it works
  • How to write clients and servers using the User Datagram Protocol (UDP) and the Transport Control Protocol (TCP)
  • The advantages of multi-threaded applications, which allow network applications to perform multiple tasks concurrently
  • How to implement network protocols, including examples of client/server implementations
  • The HyperText Transfer Protocol (HTTP) and how to access the World Wide Web using Java
  • How to write server-side Java applications for the WWW
  • Distributed computing technologies including remote method invocation (RMI) and CORBA
  • How to access e-mail using the extensive JavaMail API
  • What You’ll Need

    A reasonable familiarity with Java programming is required to get the most out of this book. You’ll need to be able to compile and run Java applications and to understand basic concepts such as classes, objects, and the Java API. However, you don’t need to be an expert with respect to the more advanced topics covered herein, such as I/O streams and multi-threading. All examples use a text interface, so there’s no need to have GUI experience.

    You’ll also need to install the Java SDK, available for free from Sun Micro-systems (http://java.sun.com/j2se/). Java programmers will no doubt already have access to the SDK, but readers should be aware that some examples in this text will require JDK 1.1, and the advanced sections on servlets, RMI and CORBA, and JavaMail will require Java 2.

    A minimal amount of additional software is required, and most of the tools for Java programming are available for free and downloadable via the WWW. Chapter 2 includes an overview of Java development tools, but readers can also use their existing code editor. Readers will be advised when examples feature additional Sun Microsystems software.

    Companion Web SiteAs a companion to the material covered in this book, the book’s Web site offers the source code in downloadable form (no need to wear out your fingers!), as well as a list of Frequently Asked Questions about Java Networking, links to networking resources, and additional information about the book. The site can be found at http://www.davidreilly.com/jnpbook/.Contacting the Authors

    We welcome feedback from readers, be it comments on specific chapters or sections or an evaluation of the book as a whole. In particular, reader input about whether topics were clearly conveyed and sufficiently comprehensive would be appreciated. While we’d love to receive only praise, honest opinions are valued (as well as suggestions about coverage of new networking topics).

    Feel free to contact us directly. While we can’t guarantee an individual reply, we’ll do our best to respond to your query. Please send questions and feedback via e-mail to: jnpbook@davidreilly.com.

    David Reilly and Michael Reilly
    September 2001




    Absolute filename, 233

    Abstract classes, 69

    accept() method, 161, 162

    AccessException class, 332

    ACK (acknowledgment) packet, 139

    Activatable class, 334-336, 345

    Activatable objects

       activation description, 335

       activation descriptor, 336-337

       activation ID, 335

       creating new instances, 338

       stub, 336

    Activatable remote object

       creation of, 368-369

       notification of, 366

       registering, 369-376

    ActivatableLightBulbServer application, 369-376

    ActivatableLightBulbServer class, 373

    ActivateFailedException exception, 339

    Activation, 334-339

       remote objects supporting, 334-336

       security manager, 373

    Activation descriptor

       associated with default activation group, 337

       associated with specified activation group, 336-337

       codebase of class represented by, 337

       creation of, 374-375

       hashcode, 337

       name of class represented by, 337

       object represented, 337

    Activation descriptor object, 336

    Activation group descriptor, 374

    Activation group ID, 337

    Activation groups, 338-339

    ActivationDesc class, 336-337

    ActivationDesc() method, 336-337

    ActivationException exception, 339

    ActivationGroup class, 338

    ActivationGroupDesc class, 338

    ActivationGroup.getSystem() method, 374

    ActivationGroupID class, 338

    ActivationGroupID() method, 338

    ActivationID class, 339

    ActivationSystem class, 374

    ActivationSystem interface, 339, 374

    ActivationSystem.registerGroup method, 374

    ActivatonGroup.createGroup() method, 374

    Active objects no longer active, 335

    Active Server Pages, 240

    activeCount() method, 197, 198

    activeGroupCount() method, 197

    Adapter class, 433

    addConnectionListener() method, 407, 410

    addFolderListener() method, 409, 410

    addFrom() method, 405

    addMessageChangedListener() method, 410

    addMessageCountListener() method, 410

    addReceipt() method, 405

    addRecipients() method, 405

    Address class, 404

    Address mask, 16

    Address Mask Request/Address Mask Reply ICMP message, 16

    addStoreListener() method, 409

    addTemperatureListener() method, 360

    addTransportListener() method, 415

    allowThreadSuspension() method, 197

    “allowUserInteraction” field, 257, 259

    AlreadyBoundException class, 332

    AltaVista search engine, 281, 285

    Apache JServ add-on, 293

    Apache JServ Web site, 293

    Apache Web server, 293

    Apache Web site, 293

    API (Application Program Interface), 37-38

    appendMessages() method, 410

    Applets, 43

       digitally signed, 39

       firewall restrictions, 355-356

       games, 41

       inability to bind to TCP ports, 354

       limitations, 33

       network access restrictions, 39

       network connection restrictions, 355

       RMI (remote method invocation), 354-356

       security policies limitations, 287

       security restrictions, 39

    Application layer, 8

    Application protocols

       implementation, 207-236

       lower-level (Open Systems Interconnection) model layers, 205

       RFC (Request For Comment) documents, 206

       specifications, 206-207


       communicating through ports, 144

       interoperating, 205

       sequential access to data, 139

       stand-alone, 39

    Architecture evolution, 8-9

    ARP (Address Resolution Protocol), 14

    ARPANET, 8-9

    Array of characters, printing, 88

    ArrayOutOfBoundsException exception, 198

    autoexec.bat file, 295

    Automatic error control, 142-143

    Automatic garbage collection, 30-31

    available() method, 72

    AWT (Abstract Windowing Toolkit), 46, 358, 428

    AWTError class, 46


    “Backwards” CGI script, 285

    badVariable variable, 290

    BEA Weblogic Web site, 294

    Berners-Lee, Tim, 224

    BindException exception, 165, 166

    bind() method, 331, 341

    Blocking I/O, 71

    Block-level synchronization, 188-189

    Blocks of code, locking, 188

    Boolean value, printing, 87

    Borland Enterprise Application Server Web site, 294

    Borland JBuilder, 52

    Borland Web site, 52

    Browsers, 18

       responding to requests from, 229

       runtime environments, 36

    Buffered stream

       InputStream object, 80

       sizing, 81

    Buffered writer, 103

    BufferedInputStream class, 80-81, 81, 255

    BufferedInputStream() method, 80, 81

    BufferedOutputStream class, 85-86, 155

    BufferedOutputStream() method, 85

    BufferedReader class, 89, 94, 95-96, 125, 153

    bufferedReader() method, 95

    BufferedWriter class, 102-103, 155, 297

    BufferedWriter() method, 103

    Buffering together write requests, 102-103


       push-back reader, 96

       reading data into, 95

       strings, 100-101

    writers, 99

    Byte stream, 108-109, 142

    ByteArrayInputStream class, 70, 125, 129

    ByteArrayOutput Stream class, 131

    ByteArrayOutputStream class, 75

    Bytecode, 31


    C#, 53

    C++, 29

    C and error checking, 45

    Cache flag, 257, 259

    Caching requests, 260


       local, 358

       object-oriented, 356-358

       remote, 358

       RMI (remote method invocation) implementation, 356-365

       running example, 364-365

    Catch statement, 48-49

    Catching exceptions, 45-47

    CGI (Common Gateway Interface), 240, 277-286

       parameters, 278

       variables and servlets, 300

    CGI scripts, 36, 240, 281

    Character array readers, 91

    Character array writers, 99

    Character value, printing, 88

    CharArrayReader() method, 91

    CharArrayWriter class, 99

    CharArrayWriter() method, 99

    checkAccess() method, 197

    checkError() method, 87

    Checksum, 13

    Class A IP addresses, 57, 58

    Class B IP addresses, 58

    Class C IP addresses, 58

    Class D IP addresses, 58, 63

    Class E IP addresses, 58

    ClassCastException exception, 112


       abstract, 69

       capable of running as threads, 177

       definition at different locations, 350-351

       for following network resources, 34

       RMI (remote method invocation), 329-349

    ClassNotFoundException exception, 351

    Classpath environment variable, 50, 295

       JavaMail API, 402

    Client JVM, uniquely identifying, 339-340

    Client sockets, 148-157

       connections, 159

    Clients, 145-147

       codebase, 352

       connecting with resource, 256

       CORBA (Common Object Request Broker Architecture), 382-383

       ease of connecting to remote services, 152-153

       error set of status codes, 245

       MIME type in documentation check-in/check-out system, 307

       request header fields, 241-243

       requesting connection to server socket, 161-162

       RMI (remote method invocation), 328

       sending MIME-encoded data to, 302-305

    Client/server paradigm, 145-147

    clone() method, 348

    CloneNotSupportedException exception, 348

    close() method, 72, 76-77, 90, 98, 123, 150, 162, 407, 410-411

    Codebase directory, 351

    Command line

       parameter null value, 252

       passing system properties from, 50-51

    Commercial IDE packages, 52-53


       between applications using ports, 144

       with Web server, 239

    Communication pipes, 189, 190-192

    Communication ports, 16, 144

    Comparing IP addresses, 63

    Computer games, 40-41

    Computers, 1

    Connected pipe reader, 92

    ConnectException class, 332

    ConnectException exception, 47, 166

    ConnectIOException class, 332

    ConnectionListener class, 429, 433, 434


       request method, 273

       used for input or output, 257

    connect() method, 92, 100, 123, 149, 256, 407, 408

    Constants, 290

    “Content-encoding” header field, 257

    CONTENT_LENGTH environment variable, 300

    “Content-Length” field, 246, 257, 263

    “Content-Type” field, 246, 262

    Controlling threads, 178-183

    Cookie class, 309-311

    Cookies, 242, 308

       sending to browser, 247

       servlets, 309-311

       variables, 309

    CookieTest servlet, 309-311

    copyMessages() method, 411

    CORBA (Common Object Request Broker Architecture), 34, 38, 44

       architectural view, 380-383

       clients, 382-383

       distributed lightbulb service, 387

       exception handling, 386

       exporting servant, 391

       IDL (Interface Definition Language), 383

       IIOP (Internet Inter-ORB Protocol), 381-382

       multilanguage abilities, 380

       name service, 382-383

       ORB (object request broker), 381

       removing communication between objects, 395-396

       RMI (remote method invocation), 379

       robustness, 382

       schema, 382

       servant, 382

       services and clients, 380

       writing servant code, 388-392

    Country-code top-level domains, 60

    CPU (central processing unit), 169

    createGroup(..) method, 338

    create() method, 411

    createRegistry() method, 342

    createServerSocket() method, 344, 346

    createSocket() method, 344, 346

    Current machine IP addresses, 64-65

    Customized sockets, 345-347


    -D flag, 50

    Daemon group, 199

    Daemon process, 147

    Daemon threads, 175-176


       out-of-sequence, 4

       undelivered and time queued for delivery, 155

    “DATA” command, 215

    Data input stream construction, 82

    Data link layer, 7

    Data marshaling, 320

    Data packets and UDP (User Datagram Protocol), 119-121

    Data streams, definition of, 67-68

    Data transmission with packets, 4-5

    Datagram packet sequence number, 139, 143

    DatagramPacket class, 119-121, 125, 131

    DatagramPacket() method, 120-121

    DatagramSocket class, 122-123, 125, 132, 147, 155

    DatagramSocket() method, 122

    DatagramSocket.receive method, 124

    DatagramSocket.setToTimeout() method, 143

    DataInputStream class, 81-83, 108, 125, 255

    DataInputStream() method, 82

    DataInputStream.readLine() method, 89, 96

    DataOutput interface, 109

    DataOutputStream class, 86-87

    DataOutputStream() method, 86


       printing as text, 87

       reading, 81-83

       writing to file, 86

    “Date” header field, 257

    DayTime server, 159

    DaytimeClient application, 157-159

    DaytimeServer application, 163

    Deadlock, 181

    Debugging servlets, 306

    DejaNews Web site, 19

    DELETE HTTP requests, 290, 292-293

    delete() method, 411

    Delphi, 29

    Destination Unreachable ICMP message, 15

    destroy() method, 197, 290, 291

    Developers and firewalls, 23

    Development tools

       IDE (integrated development environment), 51-53

       SDK (system development kit), 53

       user interface, 51

    Devices, 1, 2

    DHCP (Dynamic Host Control Protocol) server, 58

    Digitally signed applets, 39

    disconnect() method, 123, 272

    displayEmails() method, 221

    Distributed garbage collection, 339-341

    Distributed systems, 43-44

    DNS (Domain Name System), 59-61

    DNS server, 61

    docroot variable, 230

    doDelete() method, 290

    doGet() method, 290

    Domain name resolution, 61

    Domain names, 60

    doOptions() method, 290

    doPost() method, 290

    doPut() method, 290

    doSomething() method, 368, 369

    doTrace() method, 290

    Dotted decimal format, 61, 63

    Double value, printing, 88

    Downloading JSDK (Java Servlet Development Kit), 294

    Dropped packets, 118

    Dynamic class loading, 332, 349-352, 364, 375

    Dynamically assigned IP addresses, 56, 58


    Echo client, 135-138

    Echo Request/Echo Reply ICMP message, 15

    Echo server, 138

    Echo service, 132-134

    E-mail, 399

       retrieving messages, 423-427

       sending file as attachment, 435-438

       sending messages, 418-423

    E-mail clients, 18

    Emulation, 35

    Entity body, 247

       meta-information about, 247

       MIME content type, 246

       number of bytes, 246

    enumerate() method, 197-198

    Enumeration, unable to access next element, 47

    Environment variables, 50

    equals() method, 63, 249, 337, 338, 340, 344

    Error class exceptions, 45-46

    Ethernet address, 3

    Ethernet card, 2

    Event source

       defining interface, 359

       implementing interface, 359-362

       listeners, 356


       JavaMail, 429-430

       notifying object of, 356-358

       notifying waiting thread of, 192-193

    /examples/ directory, 295

    /examples/WEB-INF/servlets directory, 295

    Exception class and exceptions, 46-47

    Exception handlers, 44-50

       catch statement, 48-49

       finally statement, 48, 49

       IDL (Interface Definition Language), 386-387

       sockets, 165-167

       try statement, 48

    Exception objects, 45


       catching, 45-47

       causes, 49-50

       definition of, 45

       Error class, 45-46

       Exception class, 46-47

       inheritance, 45

       Java API, 321

       java.rmi.server package, 348

       remote method, 333

       security restrictions, 50

       servlets, 308

       state of network connection, 49

       throwing, 45-47

       types, 45-47

    exists() method, 411

    “Expires” field, 246-247, 257

    ExportException exception, 348

    exportObject() method, 334-335, 348

    expunge() method, 411

    Extensions, 38

    External Internet mail service, 409


    Faulting remote reference, 366-367

    fetch() method, 411

    FetchURL application, 253-256

    FetchURLConnection application, 260-263

    Fiber-optic cables, 3

    FieldInputStream class, 234

    FIFO queue, 76

    FileDataSource class, 438

    FileInputStream low-level input stream, 70

    FileInputStream object, 74

    FileInputStreamDemo application, 74

    File.listFiles() method, 235

    FileNameMap interface, 257-258

    Filenames, mapping MIME content types to, 257-258

    FileOutputStream class, 78, 112

    FileOutputStream low-level output stream, 75

    FileOutputStreamDemo application, 78-79

    FileReader class, 92, 234

    FileReader() method, 92


    MIME type, 307

       transferring, 18

    FileWriter class, 99

    FileWriter() method, 99

    Filter input streams

       BufferedInputStream class, 80-81

       DataInputStream class, 81-83

       LineNumberInputStream class, 84

       PushBackInputStream class, 84-85

       pushing back data for reading later, 84-85

    Filter output streams

       BufferedOutputStream class, 85-86

       buffering writes, 85-86

       DataOutputStream class, 86-87

       PrintStream class, 87-88

    Filter readers

       BufferedReader class, 95-96

       buffering characters, 95

       FilterReader class, 96

       line counter, 97

       LineNumberReader class, 97

       PushBackReader class, 96-97

    Filter streams, 68, 79-88

    Filtered writers, 102-104

    FilterInputStream class, 80

    FilterReader class, 96


       socket streams, 153

       templates, 96, 103

    FilterWriter class, 103

    FilterWriter() method, 103

    finalize() method, 408, 411

    Finally statement, 48, 49


       out about other addresses, 65-66

       RFC (Request For Comments) documents, 206-207

    Finger, 19

    Firewall tunneling, 355-356

    Firewalls, 21-22

       applet restrictions, 355-356

       developers, 23

    Flow control, 139-140

    flush() method, 77, 85, 98

    Folder class, 410-415

    Folder.close() method, 427

    FolderListener class, 429

    fork() command, 32

    Frames, 7

    FTP (File Transfer Protocol), 18, 206, 268


    Games, 40-41

    Garbage collection, 30-31, 339-341

    Garbage collector, unable to free objects, 46

    Gateways, 2

    Generic socket error, 166

    GenericServlet class, 290

    “GET” command, 232

    GET HTTP requests, 229, 232-233, 239, 290-292

       sending, 278-281

       versions, 240

    GET method, 239-240, 277, 278

    getAbsoluteName() method, 412

    getAddress() method, 63, 121

    getAllbyName() method, 63

    getAllowUserInteraction() method, 257

    getBuffer() method, 101

    getByName() method, 63, 66

    getClassName() method, 337

    getClientHost() method, 345

    getContentEncoding() method, 257

    getContentLength() method, 257, 300

    getContent() method, 250, 257

    getContentType() method, 258

    getCount() method, 187

    getData() method, 121, 337

    getDate() method, 257

    getDebug() method, 417

    getDefaultAllowUserInteractionField() method, 257

    getDefaultFolder() method, 409

    getDefaultInstance() method, 416-417

    getDefaultRequestProperty() method, 257

    getDefaultSocketFactory() method, 346

    getDefaultUseCaches() method, 257

    getDoInput() method, 257

    getDoOutput() method, 257

    getDuration() method, 341

    getEncoding() method, 93, 101

    getErrorStream() method, 272

    getExpiration() method, 257

    getFailureHandler() method, 346

    getFile() method, 250

    getFileNameMap() method, 257-258

    getFlags() method, 405

    getFolder() method, 405, 409, 411, 417

    getFollowRedirects() method, 272

    getFrom() method, 405, 426

    getFullName() method, 411-412

    getGroupID() method, 337

    getHeaderFieldData() method, 258

    getHeaderFieldInt() method, 258

    getHeaderFieldKey() method, 258

    getHeaderField() method, 258

    getHeader() method, 300

    getHostAddress() method, 63, 64, 65

    getHost() method, 250

    getHostName() method, 63, 64

    getID() method, 335

    getInetAddress() method, 123, 150, 162

    getInitParameter() method, 305

    getInitParameterNames() method, 305

    getInput() method, 221

    getInputStream() method, 150, 153, 258

    getInstance() method, 417

    getKeepAlive() method, 151

    getLastModified() method, 258

    getLength() method, 121

    getLineNumber() method, 84, 97

    getLocalAddress() method, 123, 151

    getLocalHost() method, 63, 64-65

    getLocalPort() method, 123, 151, 162

    getLocation() method, 337

    getLog() method, 345

    getMajorVersion method, 306

    getMaxPriority() method, 198

    getMessageCount() method, 412

    getMessageNumber() method, 405

    getMessages() method, 412

    getMimeType method, 306

    getMinorVersion method, 306

    getMode() method, 412

    getName() method, 199, 412

    getNewMessageCount() method, 412

    getOutputStream() method, 150, 258

    getParameterValues() method, 302

    getParent() method, 199, 412

    getPasswordAuthentication() method, 417

    getPermanentFlags() method, 412

    getPermission() method, 258-259

    getPort() method, 123, 151, 250

    getProperties() method, 417

    getProperty() method, 417

    getProtocol() method, 250

    getProvider() method, 417

    getProviders() method, 417

    getRealPath() method, 307

    getReceiveBufferSize() method, 123, 151

    getReceivedDate() method, 405

    getRecipients() method, 405

    getRef() method, 250

    getRegistry() method, 342-343

    getReplyTo() method, 405

    getRequestMethod() method, 272

    getRequestProperty() method, 259

    getResponseCode() method, 272

    getResponseMessage() method, 272

    getRestartMode() method, 337

    getSendBufferSize() method, 123, 151

    getSentDate() method, 406

    getSeparator() method, 412

    getServletContext() method, 306

    getSession() method, 312

    getSocketFactory() method, 346

    getSoLinger() method, 151

    getSoTimeout() method, 123, 162

    getStore() method, 412, 417

    getSubject() method, 406, 426

    getSystem() method, 338

    getTcpNoDelay() method, 151

    getTransport() method, 417-418

    getType() method, 413

    getUnreadMessageCount() method, 413

    getURL() method, 259

    getURLName() method, 408, 413

    getUseCaches() method, 259

    getVMID() method, 341

    goodVariable variable, 290

    Gosling, James, 28

    Grouping threads, 194-200

    Guaranteed delivery, 138-139, 142

    guessContentTypeFromStream() method, 257, 259

    GUI applications and multi-threading, 172

    GUI design tools, 52


    Handler class, 231

    Handler functions, 291

    Hardware, 1

       address, 3

       independence, 9

    hashCode() method, 250, 337, 338, 340, 344

    HEAD request, 239, 240

    Header fields

       assigning value, 260

       modifying and examining, 264-268

       name of nth, 258

       parsing as date, 258

       parsing as number, 258

    HelloWorld servlet, 295, 298-299

    HelloWorld.class file, 295

    “HELO” hostname identification command, 214

    Helper class, 395

    High ASCII characters, 89

    High-level filter streams, 71

    Host machine and unique VMID (virtual machine identifier), 340

    Hostnames, 14, 63, 65-66, 132

    Hosts, 61

    hosts.txt file, 60

    Host-to-IP-address mappings, 60

    HotJava, 28

    HTCPCP (HyperText Coffee Pot Control Protocol), 206

    HTML, 235

    HTTP (HyperText Transfer Protocol), 18-19, 224, 248

       CGI (Common Gateway Interface), 277-286

       connecting client and resource, 256

       HttpURLConnection class, 268-277

       operation of, 237-239

       reading responses, 256-268

       redirects, 272

       sending requests, 256-268

       session management, 312-313

       stateless model, 308, 312

       status codes, 302

       TCP (Transmission Control Protocol), 237

       URL class, 248-250

       URL-Connection class, 256-268

       Web browsers, 237

    HTTP clients

       identifying type, 243

       request header fields, 241-243

       TCP connection to Web server, 237-238

    HTTP requests

       issuing, 266

       servlet methods, 290

       tracking state, 312

       valid, 293

    HTTP response, 238

    HTTP servlets, 290

    HTTP servers

       connection, 238

       implementation, 224-236

       response header fields, 245-247

       status, 244-245

       transaction, 238

    HTTP/1.1, 224

       status codes and integer static constants, 303-304

    HTTP_ACCEPTED - HTTP status code (202) field, 269

    HTTP_BAD_GATEWAY - HTTP status code (502) field, 272

    HTTP_BAD_METHOD - HTTP status code (405) field, 271

    HTTP_BAD_REQUEST - HTTP status code (400) field, 271, 291

    HTTP_CLIENT_TIMEOUT - HTTP status code (408) field, 271

    HTTP_CONFLICT - HTTP status code (409) field, 271

    HTTP_CREATED - HTTP status code (201) field, 269

    HTTP_ENTITY_TOO_LARGE - HTTP status code (413) field, 271

    HTTP_FORBIDDEN - HTTP status code (403) field, 271

    HTTP:_GATEWAY_TIMEOUT - HTTP status code (504) field, 272

    HTTP_GONE - HTTP status code (410) field, 271

    HTTPHeaders application, 264-268

    HTTP_INTERNAL_ERROR - HTTP status code (501) field, 272

    HTTP_LENGTH_REQUIRED - HTTP status code (411) field, 271

    HTTP:_MOVED_PERM - HTTP status code (301) field, 270

    HTTP_MOVED_TEMP - HTTP status code (302) field, 270

    HTTP_MULT_CHOICE - HTTP status code (300) field, 270

    HTTP_NO_CONTENT - HTTP status code (204) field, 270

    HTTP_NOT_ACCEPTABLE - HTTP status code (406) field, 271

    HTTP_NOT_AUTHORITATIVE - HTTP status code (203) field, 270

    HTTP_NOT_FOUND - HTTP status code (404) field, 271

    HTTP_NOT_MODIFIED - HTTP status code (304) field, 270

    HTTP_OK - HTTP status code (200) field, 269

    HTTP_PARTIAL - HTTP status code (206) field, 270

    HTTP_PAYMENT_REQUIRED - HTTP status code (402) field, 271

    HTTP_PRECON_FAILED - HTTP status code (412) field, 271

    HTTP_PROXY_AUTH - HTTP status code (407) field, 271

    HTTP_REQ_TOO_LONG - HTTP status code (414) field, 272

    HTTP_RESET - HTTP status code (205) field, 270

    HttpResponse class, 302-305

    HTTP_SEE_OTHER - HTTP status code (303) field, 270

    HTTP_SERVER_ERROR - HTTP status code (500) field, 272

    HttpServlet class, 290, 297

    HttpServletRequest class, 300-302, 312

    HttpSession class, 312-313

    HTTP_UNAUTHORIZED - HTTP status code (401) field, 271

    HTTP_UNAVAILABLE - HTTP status code (503) field, 272

    HTTP_UNSUPPORTED_TYPE - HTTP status code (415) field, 272

    HttpURLConnection class, 268-277

       accessing HTTP-specific functionality, 273-277

       static fields, 269-272

       usage, 269-273

    HTTP_USE_PROXY - HTTP status code (305), 270-271

    HTTP_USER_AGENT environment variable, 300

    HTTP_VERSION - HTTP status code (505) field, 272

    Hubs, 2

    Hyperlinks, 224, 237

    Hypertext documents, 237


    IANA (Internet Assigned Numbers Authority), 58, 59

    IANA (Internet Assigned Numbers Authority) Web site, 58

    IBM Web site, 52

    ICANN (Internet Corporation for Assigned Names and Numbers), 58

    ICANN (Internet Corporation for Assigned Names and Numbers) Web site, 58

    ICMP (Internet Control Message Protocol), 14-16

    IDE (integrated development environment), 51-53

    IDL (Interface Definition Language), 380

       attributes, 385

       datatypes, 384

       exception handling, 386-387

       interfaces, 384

       mapping schema to Java, 388

       modules, 384

       operations, 385-386

       overview, 383

       writing client code, 392

       writing CORBA service, 387

       writing servant code, 388-392

    idl2java.exe program, 388

    idlj compiler, 395

    idlj.exe, 388

    “If-Modified-Since” header, 242, 260

    IIS (Internet Information Server), 293

    IllegalArgumentException exception, 121, 336

    IllegalStateException exception, 410, 414

    implAccept() method, 162

    inactive() method, 335

    INBOX folder, 410, 425-426

    increaseCount() method, 186

    InetAddress class, 63-66, 131

    Informational set of status codes, 244

    Infrared, 3


       exceptions, 45

       objects, 74

    init() method, 288, 290, 291

    Inner classes, 230, 429

    Input flag, 259

    Input streams, 68, 213

       blocking I/O, 71

       byte array not filled, 82

       closing, 72

       converting line of text to string, 83

       current position in, 72

       double value, 82

       float value, 82

       freeing resources, 72

       int value, 82-83

       length of data read, 82

       long value, 83

       low-level streams, 69-70, 73-75

       moving back to preset mark, 72

       next byte of data, 72

       nonzero byte, 82

       number of bytes to read, 72

       offset within array, 82

       pushing back array contents, 84

       pushing back byte to front of buffer, 85

       pushing back subset of array, 84-85

       readers, 93

       reading, but ignoring bytes, 72-73

       reading byte from, 82

       reading character from, 82

       reading from, 69-75, 84

       reading sequence of bytes to byte array, 72

       reading string with, 83

       sequentially reading, 70-71

       short value, 83

       sizing buffer, 84

       skipping over bytes, 83

       tracking number of lines read from, 84

    InputStream class, 71-75, 80, 253, 255, 256, 263

    InputStream object, 74, 258

    InputStreamReader class, 93, 94, 125

    InputStreamReader() method, 93

    InputStreamToReaderDemo application, 94



    Submit Errata

    More Information

    InformIT Promotional Mailings & Special Offers

    I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


    Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

    This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

    Collection and Use of Information

    To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

    Questions and Inquiries

    For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

    Online Store

    For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


    Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

    Contests and Drawings

    Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


    If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

    Service Announcements

    On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

    Customer Service

    We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

    Other Collection and Use of Information

    Application and System Logs

    Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

    Web Analytics

    Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

    Cookies and Related Technologies

    This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

    Do Not Track

    This site currently does not respond to Do Not Track signals.


    Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


    This site is not directed to children under the age of 13.


    Pearson may send or direct marketing communications to users, provided that

    • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
    • Such marketing is consistent with applicable law and Pearson's legal obligations.
    • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
    • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

    Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

    Correcting/Updating Personal Information

    If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


    Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

    Sale of Personal Information

    Pearson does not rent or sell personal information in exchange for any payment of money.

    While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

    Supplemental Privacy Statement for California Residents

    California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

    Sharing and Disclosure

    Pearson may disclose personal information, as follows:

    • As required by law.
    • With the consent of the individual (or their parent, if the individual is a minor)
    • In response to a subpoena, court order or legal process, to the extent permitted or required by law
    • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
    • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
    • To investigate or address actual or suspected fraud or other illegal activities
    • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
    • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
    • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


    This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

    Requests and Contact

    Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

    Changes to this Privacy Notice

    We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

    Last Update: November 17, 2020