Skip to Content
Head First Java, 2nd Edition
book

Head First Java, 2nd Edition

by Kathy Sierra, Bert Bates
February 2005
Beginner
720 pages
19h 12m
English
O'Reilly Media, Inc.
Content preview from Head First Java, 2nd Edition

Chapter 15. Networking and Threads: Make a Connection

image with no caption

Connect with the outside world. Your Java program can reach out and touch a program on another machine. It’s easy. All the low-level networking details are taken care of by classes in the java.net library. One of Java’s big benefits is that sending and receiving data over a network is just I/O with a slightly different connection stream at the end of the chain. If you’ve got a BufferedReader, you can read. And the BufferedReader couldn’t care less if the data came out of a file or flew down an ethernet cable. In this chapter we’ll connect to the outside world with sockets. We’ll make client sockets. We’ll make server sockets. We’ll make clients and servers. And we’ll make them talk to each other. Before the chapter’s done, you’ll have a fully-functional, multithreaded chat client. Did we just say multithreaded? Yes, now you will learn the secret of how to talk to Bob while simultaneously listening to Suzy.

Real-time Beat Box Chat

image with no caption

You’re working on a computer game. You and your team are doing the sound design for each part of the game. Using a ‘chat’ version of the Beat Box, your team can collaborate—you can send a beat pattern along with your chat message, and everybody in the Beat Box Chat gets it. So you don’t just get to read the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Head First Java, 3rd Edition

Head First Java, 3rd Edition

Kathy Sierra, Bert Bates, Trisha Gee
Learning Java, 6th Edition

Learning Java, 6th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
Learning Java, 4th Edition

Learning Java, 4th Edition

Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 0596009208Supplemental ContentErrata Page