Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

15. Networking and Threads: Make a Connection

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 could 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.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint