Chapter 11. Networking with NIO


Terms you'll need to understand:

  • Socket

  • URL

  • TCP/IP

  • IP address

  • HTTP

  • Ping

  • Protocol

  • Multithreaded

  • Network stack

Techniques you'll need to master:

  • Using New Input/Output (NIO) classes for building a browser

  • Interrogating a URL

  • Recognizing the various parts of a URL

  • Working with sockets on both the client and server side

  • Knowing the state of a socket

  • Knowing how to build a server with sockets

  • Building a multithreaded Web server with sockets

This chapter focuses on Java's networking features. You learn how to communicate with other computers and build a browser and a Web server. This chapter also reviews the basics of Java NIO; this portion of J2SE 1.4 has grown substantially since previous versions, which is great news for candidates who choose sockets for the networking part of the certification project. In other chapters, the sample solution discussed in this book uses RMI. However, NIO is an important change to J2SE, and some candidates do use it. Therefore, this chapter covers some of the more interesting aspects of networking that are possible with Java. The sample programs shown in this chapter can be adapted easily for your project.

There are many ways to implement socket functionality for your project. Rather than present only one solution, I have supplied many code listings that offer a wide range of possibilities. If you choose sockets over RMI, you can pick one or more listings in this chapter to build your solution on. Networking is a significant contribution to your score. Although I recommend using RMI to satisfy this requirement, sockets communication is also viable . In fact, many programmers have experience with sockets, but the same cannot be said for RMI. If you go the socket route, this chapter will give you ideas for building the network component of your solution with sockets. There are enough examples here to address all facets of satisfying the evaluator 's requirements and to code an effective application in which the client communicates with the database via sockets.



JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net