Chapter 17. Make a Connection: Networking and Threads
Connect with the outside world. Your Java program can talk to a program on another machine. Itâs easy. All the low-level networking details are taken care of by the built-in Java libraries. One of Javaâs big benefits is that sending and receiving data over a network can be just I/O with a slightly different connection at the end of the I/O chain. In this chapter weâll connect to the outside world with channels. Weâll make client channels. Weâll make server channels. Weâll make clients and servers, and weâll make them talk to each other. And weâll also have to learn how to do more than one thing at once. 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 BeatBox chat
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 BeatBox, your team can collaborateâyou can send a beat pattern along with your chat message, and everybody in the BeatBox ...
Get Head First Java, 3rd Edition 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.