26.07.2013 Views

Java How to Program Fourth Edition - DCC

Java How to Program Fourth Edition - DCC

Java How to Program Fourth Edition - DCC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 17 Networking 1063<br />

ruptedIOException, which the current thread can catch, then continue executing. This prevents<br />

the current thread from deadlocking if there is no more data available from the Socket.<br />

• Multicast is an efficient way <strong>to</strong> send data <strong>to</strong> many clients without the overhead of broadcasting that<br />

data <strong>to</strong> every host on the Internet.<br />

• Using multicast, an application can “publish” DatagramPackets <strong>to</strong> be delivered <strong>to</strong> other applications—the<br />

“subscribers.”<br />

• An application multicasts DatagramPackets by sending the DatagramPackets <strong>to</strong> a multicast<br />

address—an IP address in the range from 224.0.0.0 <strong>to</strong> 239.255.255.255, reserved for multicast.<br />

• Clients that wish <strong>to</strong> receive DatagramPackets can connect <strong>to</strong> the multicast address <strong>to</strong> join the<br />

multicast group that will receive the published DatagramPackets.<br />

• Multicast DatagramPackets are not reliable—packets are not guaranteed <strong>to</strong> reach any destination.<br />

Also, the order in which clients receive the datagrams is not guaranteed.<br />

• The MulticastSocket construc<strong>to</strong>r takes as an argument the port <strong>to</strong> which the Multicast-<br />

Socket should connect <strong>to</strong> receive incoming DatagramPackets. Method joinGroup of class<br />

MulticastSocket takes as an argument the InetAddress of the multicast group <strong>to</strong> join.<br />

• Method receive of class MulticastSocket reads an incoming DatagramPacket from a<br />

multicast address.<br />

TERMINOLOGY<br />

accept a connection deny a connection<br />

accept method of ServerSocket class duplicated packets<br />

addElement method of class Vec<strong>to</strong>r get method of class Hashtable<br />

AppletContext interface getAddress method of DatagramPacket<br />

bind <strong>to</strong> a port getAppletContext method of class Applet<br />

BindException class getByName method of InetAddress<br />

client getData method of class DatagramPacket<br />

client connects <strong>to</strong> a server getEventType method<br />

client/server relationship getInputStream method of class Socket<br />

client-side socket getLength method of DatagramPacket<br />

close a connection getLocalHost method<br />

close method of class Socket getLocalHost method of InetAddress<br />

collaborative computing getOutputStream method of class Socket<br />

computer networking getPort method of class DatagramPacket<br />

connect <strong>to</strong> a port getPredefinedCursor method of Cursor<br />

connect <strong>to</strong> a World Wide Web site getURL method of class HyperlinkEvent<br />

ConnectException class handshake point<br />

connection Hashtable class<br />

connection request heterogeneous computer systems<br />

connectionless service host<br />

connectionless transmission with datagrams Hyperlink.EventType class<br />

connection-oriented service Hyperlink.EventType.ACTIVATED<br />

Cursor class Hyperlink.EventType.ENTERED<br />

Cursor.DEFAULT_CURSOR Hyperlink.EventType.EXITED<br />

Cursor.WAIT_CURSOR HyperlinkEvent class<br />

datagram HyperlinkListener interface<br />

datagram socket hyperlinkUpdate method<br />

DatagramPacket class InetAddress class<br />

DatagramSocket class Internet

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!