22

Networking in Java

LEARNING OBJECTIVES

At the end of the chapter, you will be able to understand and use

  • TCP/IP protocols.
  • Inet addressing mechanism and URL connections.
  • TCP/IP sockets.
  • Client server applications.

22.1 Introduction

Java has been specially created for networking. What do we mean by this? Java supports a package called java.net which defines several methods for connecting and retrieving files by using common web-based protocols. Java also allows us to create unix-like sockets and allows us to implement TCP/IP sockets.

In the previous chapter on Java IO programming, you have been introduced to Input and Output Stream. By attaching those stream files with networking protocols, you can write to files on the Internet and retrieve ...

Get Object-oriented Programming Using C++ and Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.