TCP/IP Sockets in Java: Practical Guide for Programmers

Calvert, Kenneth L.; Donahoo, Michael J.

In stock
Regular price 5.000 KD inc. VAT
License
Table of contents
  • Cover
  • Table of Contentsvii
  • Prefacexi
  • Chapter 1. Introduction1
  • 1.1 Networks, Packets, and Protocols1
  • 1.2 About Addresses4
  • 1.3 About Names6
  • 1.4 Clients and Servers6
  • 1.5 What Is a Socket?7
  • 1.6 Exercises8
  • Chapter 2. Basic Sockets9
  • 2.1 Socket Addresses9
  • 2.2 TCP Sockets15
  • 2.3 UDP Sockets26
  • 2.4 Exercises38
  • Chapter 3. Sending and Receiving Data39
  • 3.1 Encoding Information40
  • 3.2 Composing I/O Streams48
  • 3.3 Framing and Parsing49
  • 3.4 Java-Specific Encodings55
  • 3.5 Constructing and Parsing Protocol Messages55
  • 3.6 Wrapping Up71
  • 3.7 Exercises71
  • Chapter 4. Beyond the Basics73
  • 4.1 Multitasking73
  • 4.2 Blocking and Timeouts86
  • 4.3 Multiple Recipients89
  • 4.4 Controlling Default Behaviors95
  • 4.5 Closing Connections101
  • 4.6 Applets107
  • 4.7 Wrapping Up107
  • 4.8 Exercises108
  • Chapter 5. NIO109
  • 5.1 Why Do We Need This?109
  • 5.2 Using Channels with Buffers112
  • 5.3 Selectors115
  • 5.4 Buffers in Detail121
  • 5.5 Stream (TCP) Channels in Detail132
  • 5.6 Selectors in Detail135
  • 5.7 Datagram (UDP) Channels141
  • 5.8 Exercises145
  • Chapter 6. Under the Hood147
  • 6.1 Buffering and TCP150
  • 6.2 Deadlock Danger152
  • 6.3 Performance Implications155
  • 6.4 TCP Socket Life Cycle155
  • 6.5 Demultiplexing Demystified163
  • 6.6 Exercises165
  • Bibliography167
  • Index169
Book details
  • Vendor Elsevier S & T
  • SKU 9780123742551R180
  • ISBN-13 9780080568782
  • Author Calvert, Kenneth L.; Donahoo, Michael J.
  • Edition 2nd
  • Category Computers
  • Subject Network Protocols

Do you have questions about this book?

Ask an expert!

The networking capabilities of the Java platform have been extended considerably since the first edition of the book. This new edition covers version 1.5-1.7, the most current iterations, as well as making the following improvements:

The API (application programming interface) reference sections in each chapter, which describe the relevant parts of each class, have been replaced with (i) a summary section that lists the classes and methods used in the code, and (ii) a ?gotchas? section that mentions nonobvious or poorly-documented aspects of the objects.

In addition, the book covers several new classes and capabilities introduced in the last few revisions of the Java platform. New abstractions to be covered include NetworkInterface, InterfaceAddress, Inet4/6Address, SocketAddress/InetSocketAddress, Executor, and others; extended access to low-level network information; support for IPv6; more complete access to socket options; and scalable I/O. The example code is also modified to take advantage of new language features such as annotations, enumerations, as well as generics and implicit iterators where appropriate.

Most Internet applications use sockets to implement network communication protocols. This book's focused, tutorial-based approach helps the reader master the tasks and techniques essential to virtually all client-server projects using sockets in Java. Chapter 1 provides a genral overview of networking concepts to allow readers to synchronize the concepts with terminology. Chapter 2 introduces the mechanics of simple clients and servers. Chapter 3 covers basic message construction and parsing. Chapter 4 then deals with techniques used to build more robust clients and servers. Chapter 5 (NEW) introduces the scalable interface facilities which were introduced in Java 1.5, including the buffer and channel abstractions. Chapter 6 discusses the relationship between the programming constructs and the underlying protocol implementations in more detail. Programming concepts are introduced through simple program examples accompanied by line-by-line code commentary that describes the purpose of every part of the program. The book's Web site contains many examples of command-based sockets-related code discussed throughout the book. No other resource presents so concisely or so effectively the material necessary to get up and running with Java sockets programming.

KEY FEATURES

* Focused, tutorial-based instruction in key sockets programming techniques allows reader to quickly come up to speed on Java applications.
* Concise and up-to-date coverage of the most recent platform (1.7) for Java
applications in networking technology
* Provides code for all example programs via a companion Web site to let the reader see the important objects and methods in context and to understand the purpose of each line of code.