Java Network Programming, Second Edition / Edition 2

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 95%)
Other sellers (Paperback)
  • All (21) from $1.99   
  • New (2) from $175.00   
  • Used (19) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2015

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2008

Feedback rating:


Condition: New

Ships from: Chicago, IL

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Sort by


A complete treatment of network programming and cryptography in Java.

This book is the updated second edition of the popular Java Network Programming. It covers new network related features found in the Java 2 Platform, and information on related technologies, such as streaming. This is one of the best books on this subject to date. To get the most benefit from this publication, you should know Java and be familiar with the APIs. It will also help if you&#39re familiar with basic networking, CORBA and RMI.

Read More Show Less

Editorial Reviews

Provides useful techniques and code for networked applications development in Java, focusing on streams and IP-based protocols such as TCP, UDP and multicast. The second edition adds coverage of Java 2 and new material on custom URL-related factories, Java I/O, RMI, servlets, and CORBA. The sections on cryptography have been omitted, but will be available in a separate book. Annotation c. Book News, Inc., Portland, OR (
Read More Show Less

Product Details

  • ISBN-13: 9781884777493
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 5/15/1999
  • Edition description: Subsequent
  • Edition number: 2
  • Pages: 830
  • Product dimensions: 7.48 (w) x 8.89 (h) x 1.82 (d)

Meet the Author

Maria Winslow is an open source business analyst who assists clients in understanding the technical and budgetary impact open source software will have on their computing environments. She is a frequent speaker and writer on the topic of open source and is on the editorial board of LinuxWorld Magazine. She lives in Chapel Hill, North Carolina.

Read More Show Less

Read an Excerpt

Chapter 5: An Introduction to Streams

Streams are an extremely important part of network programming, and the Java API provides several stream classes with which to work. A stream is a high-level abstraction representing a connection to a communications channel, such as a TCP/IP network connection or a memory buffer. Streams can either read from a communications channel or write to it, so they are divided into two classifications: input and output.

In this chapter, we first discuss the characteristics of streams, then move on to the two generic stream classes: OutputStream and Inputstream. These are the superclasses of all other streams. The methods of these classes are detailed, then demonstrated with examples. A brief discussion of the basic stream types supplied by the API concludes the chapter. We will look at all of these streams in detail in later chapters.

5.1 Overview

Streams are the underlying abstraction behind communications in Java. A stream represents an endpoint of a one-way communications channel, as shown in figure 5.1.
Figure 5.1 OutputStream and InputStream

The communications channel usually connects an output stream to a corresponding input stream. Everything that is written to the output stream can subsequently be read from the input stream. This connection can take the form of a link through a network, a memory buffer between threads, a file, or a terminal to the user. Streams provide a uniform data interface for applications, no matter what communications channel is actually used.

All of the I/O classes in Java are supplied by the package

5. 1.1 FIFO

Streams are FIFO (first-in first-out). This means that the first thing that is written to an output stream will be the first thing that is read from the corresponding input stream. If a sequence of numbers is written to an output stream, then it will be read in the same order from the corresponding input stream.

5.1.2 Sequential access

Streams provide sequential access to the communications channel; you can write a sequence of bytes one after the other, or read a sequence of bytes in the order in which they were written. Most streams provide no random access; it is not possible to skip around and read or write bytes at just any position. Very little facility is provided for reading or writing data in anything other than a purely sequential manner: in order, one byte after another.

5.1.3 Read-only or write-only

The various stream classes provide either only reading functions or only writing functions. An output stream writes data into a communications channel; an input stream reads data out of a communications channel. There is no stream class that allows both reading and writing.

In cases where we wish to both write to and read from a single communications channel, we must use one stream to write (the output stream) and a different stream to read (the input stream). As we will see later when we look at networking applications, when you open a network connection, you obtain two streams--an input stream to read from the network and an output stream to write to the network.

5.1.4 Blocking

An important issue that arises with streams is blocking. If a thread tries to read from a user's keyboard, it cannot read any data until the user actually types something. While the thread is waiting for data to arrive (which, in this case, requires the user to type something in), it is blocking. Similarly, if a thread tries to write data to a disk, it may take a while for the data to actually be written; while the thread is waiting for the I/O operation to complete, it is blocking.

Blocking refers to a thread going to sleep because it attempts to read data and there is none available, or it attempts to write data and the operation does not happen immediately. The Java environment will let other threads run while one is blocking; the blocking thread will wake up only when data arrive or the I/O operation completes.

There is little facility for nonblocking I/O in Java. Nonblocking I/O refers to being able to read some data and return immediately if there is none available, or to write some data and to return immediately if there will be a delay. We will look at the existing nonblocking facilities when we start building network servers.

5.2 Character streams

In addition to these basic byte streams, there is a complementary set of character stream classes that derive from the superclasses Reader and Writer. Character streams are used to communicate 16-bit Unicode characters in the same way that conventional streams communicate byte-oriented data (figure 5.2). There is a complementary Reader or Writer Class for almost every byte stream class that we will encounter, and in many situations, old text-oriented streams and methods of the byte streams have been deprecated in favor of the more efficient and generalized character streams.
Figure 5.2 Reader and Writer

For all text-based communications, use of the character streams is recommended. General-purpose conversion classes are available that interface between byte streams and character streams. These can be used to interface to non-Unicode systems, such as native files and network streams. The generalized nature of these conversion classes allows text to be easily converted from Unicode to ASCII, ISO Latin 1, dingbats, or other appropriate byte encoding.

The character streams are covered in detail in chapters 10, 11, and 12. For the purposes of the following chapters, which provide examples that read text from the keyboard and write to the terminal, we will ignore issues of character conversion and consider input and output as consisting just of bytes.

5.3 Class OutputStream

The OutputStream Class represents a gateway onto a communications channel: you can write data to an Outputstream, and it will travel down the attached communications channel.

5.3.1 Constructors

There are no usable constructors for the base class Outputstream. Simply creating an OutputStream by itself is meaningless; it must be connected to a communications channel. As such, Outputstreams can only be instantiated by creating a subclass such as a FileOutputStream to a file or a PipedOutputStream to a pipe, or any subclass which actually connects to something. An outputstream is like an entrance: you cannot just create an entrance by itself; you must create an entrance to something, such as a cave or a room or a hallway. In the same way you must create an output stream to something, such as a file or network (figure 5-3).

Obviously, with Java's inheritance model, if you create a FileOutputstream, then you can subsequently pass it as just a generic Outputstream...

Read More Show Less

Table of Contents

preface to the second edition
preface to the first edition
guide to the reader
about the cover illustration
Pt. I Preliminaries
1 Introduction to networking 3
2 The Java security model 17
3 An overview of exceptions 27
4 An overview of multithreading 35
Pt. II Streams
5 An introduction to streams 61
6 File access through streams 79
7 Extending streams with filters 101
8 Supplied stream filters 119
9 Memory I/O streams 147
10 Character streams 161
11 Character stream filters 181
12 Memory-based character streams 203
Pt. III Networking
14 Client-side networking 251
15 Some example TCP/IP clients 273
16 Server-side networking 309
17 Building a Web server 325
18 Client/server Internet applications 361
19 The URL classes 401
20 Datagram networking 441
21 Some datagram applications 459
22 Multicast networking 475
Pt. IV Alternative Technologies
23 Remote method invocation 499
24 RMI in practice 535
25 CORBA 569
26 Servlets 591
27 Servlets in practice 629
Pt. V Message streams
28 Message streams 659
29 Queuing message streams 677
30 Multiplexing message streams 687
31 Routing message streams 709
32 A generic message server 719
33 Building a generic client 731
App. A Networking 751
App. B Tables 775
index 799
Read More Show Less


Well, here we are at edition two. Why did we do this again?

As before, our main reason for writing Java Network Programming is to provide you with useful techniques and code for networked applications development in Java.

With the recent updates to the Java platform, its capabilities for networking and distributed computing have expanded significantly. APIs now exist that offer new options for significant applications development

. The primary focus of this book is the fundamental networking technology provided by Java: streams and IP-based protocols such as TCP, UDP, and multicast. In this second edition we have added coverage of new API features relevant to these technologies, while, in addition, improving and extending the examples provided by the first edition to cover these changes and more.

In other areas, updates to the Java platform have introduced new networking capabilities such as RMI, CORBA, and servlets. To provide a good networking foundation in this book, we have added coverage of these important topics to the second edition. Of course, spatial limitations of the printed page limit the depth in which we can cover these specialized networking APIs. As a result we have attempted to introduce these topics sufficiently that you can make an informed choice about what technology to use, and should one catch your fancy, other dedicated books can serve you better than we could hope to.

Finally, with the Java 2 platform, a complete and far-reaching cryptography API has been added to Java's repertoire. Rather than attempting to shoehorn our cryptographic examples from the first edition into this new API, we have completely excised cryptography from this secondedition, preferring to cover that in a separate book, Applied Java Cryptography , due out after the Java APIs stabilize. In short, there was a lot of new stuff that needed coverage, some old stuff that needed revision, and then some other random things that happened to catch our attention. Plus, our publisher put a gun to our head so we didn't have any choice.


Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted January 21, 2000

    Good, but missing crypto chapters from 1st ed.

    <i>Java Network Programming, Second Edition </i>aims is the sequel to the highly popular Java Network Programming title, and picks up where the original left off. It offers considerably expanded coverage of the Java networking API, for the Java 2 platform. The authors build on chapters from the previous book, adding Java 2 specific methods and classes, and covering newer topics such as servlets, and CORBA (support for which was introduced in the Java 2 platform). <p>Readers unfamiliar with network programming, and the intricacies of sockets, are guided fairly gently through the process, with a thorough coverage of I/O streams (including files), UDP and TCP sockets, from both client and server perspective. This gives a good grounding for later development, with plenty of example clients and servers. There's also coverage of Java HTTP support, which is quite simple to work through.</p> <p>That said, readers familiar with the original title may be in for some disappointment. The strong cryptography coverage of the first book has vanished, mentioned only in the preface as the subject of a future book. Not being very cryptographically minded myself, I really enjoyed reading about this topic in the first title. Nonetheless, with the number of pages in this thick reference, something probably had to go, to save room for other topics.</p> <p>Newer topics covered in the second edition (or greatly enhanced from coverage in the first edition) include servlets, CORBA, and remote method invocation (RMI). There's even more examples than in the first edition, but there are a few gaps where coverage could have been improved (for example, the new RMI activation features are barely mentioned, and the reader is referred instead to the RMI documentation of Sun). Servlet coverage could really be improved as well - there's some great books out on the market though that can be used in companion with this book Perhaps these, and other topics will be covered in a future addition.</p> <p>As networking books go, Java Network Programming 2Ed is close to the top, but has room for improvement. Currently, however, you won't find a book that can beat it, but for advanced topics you'll probably need a second title for topics like servlets or distributed computing.</p>

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)