15: Network programming | CodeGuru

15: Network programming

Bruce Eckel’s Thinking in Java Contents | Prev | Next Historically, network programming has been error-prone, difficult, and complex. The programmer had to know many details about the network and sometimes even the hardware. You usually needed to understand the various “layers” of the networking protocol, and there were a lot of different functions in […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 1, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Historically,


network
programming has been error-prone, difficult, and complex.

The


programmer had to know many details about the network and sometimes even the


hardware. You usually needed to understand the various “layers” of


the networking protocol, and there were a lot of different functions in each


different networking library concerned with connecting, packing, and unpacking


blocks of information; shipping those blocks back and forth; and handshaking.


It was a daunting task.

However,


the concept of networking is not so difficult. You want to get some information


from that machine over there and move it to this machine here, or vice versa.


It’s quite similar to reading and writing files, except that the file


exists on a remote machine and the remote machine can decide exactly what it


wants to do about the information you’re requesting or sending.

One


of Java’s great strengths is painless networking. As much as possible,


the underlying details of networking have been abstracted away and taken care


of within the JVM and local machine installation of Java. The programming model


you use is that of a file; in fact, you actually wrap the network connection (a


“socket”) with stream objects, so you end up using the same method


calls as you do with all other streams. In addition, Java’s built-in


multithreading is exceptionally handy when dealing with another networking


issue: handling multiple connections at once.

This


chapter introduces Java’s networking support using easy-to-understand


examples.


Contents

|

Prev

|

Next
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.