[ Cafe au Lait | Java Network Programming Home Page | Examples | Corrections | Index | Order ]

Java Network Programming, 2nd Edition Index

[ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ], [ Y ], [ Z ]

A

Abstract Windowing Toolkit (see AWT), 133
accept() (ServerSocket), 355-360
Activatable class, 602, 629
ActivationGroup class, 629
addAttribute() (MutableAttributeSet), 262
addBodyPart() (Multipart), 694
addFrom() (Message), 668
addHandshakeCompletedListener(), 401
addHeader() (Part), 684
addHeaderLine() (MimeMessage), 695
addImage() (MediaTracker), 283
addRecipients() (Message), 669
Address class, 658
agents, 14
AIFF format, downloading sounds in, 272
allowUserInteraction field (URLConnection), 488
American Registry for Internet Numbers (ARIN), 21
appendMessages() (Folder), 700
Applet class, 267
AppletContext interface, 267
      image formats and, 270
      network methods of, 297-300
applets, 71
      animator, example program, 291-293
      client for remote object, example program, 610
      content handlers and, 562, 580
      context of, accessing, 297
      for displaying URLs, example program, 268
      email, sending from, 644-648
      multicast sockets and, 462
      networks and, 267-300
      security and, 72
      stubs and, 621
AppletStub interface, 267
application layer, 28
ARIN (American Registry for Internet Numbers), 21
ASN keyword, 339
asymmetric encryption, 390
AttributeSet interface, 260
.au format, downloading sounds in, 272
audio clips, downloading, 276
audio (see sounds)
AudioClip interface, 273
authentication, 228-235
      dialog, example programs, 231-235
      email passwords, 654-658
      (see also passwords)
Authenticator class, 228, 654
      email, receiving, 650
available()
      InputStream class, 83
      PushbackInputStream class, 92
AWT (Abstract Windowing Toolkit), 133

B

bind()
      Naming class, 620
      Registry interface, 626
BITPIX keyword, 582
blocks, synchronized, 139-141
breaksFlow() (Tag), 253
broadcasting, 451
BufferedReader class, 106
BufferedWriter class, 106
buffering
      client sockets and, 328
      data, 78
      readers/writers, 106-109
      streams, 79, 87-89

C

callbacks, 128-135
case sensitivity, HTML in Swing, 237
CGI (Common Gateway Interface), 68-70, 499, 594
      communicating with, 221, 223-228, 499-503
character sets, 101
      multibyte, 110
characters in URLs, converting, 219-223
chargen protocol, writing handler for, 550-555
Charlotte project, 9
chat rooms, 11
checkAll() (MediaTracker), 285
checkID() (MediaTracker), 284
checkImage() (ImageObserver), 277
cipher suites
      authentication, not requiring, 408
      JSSE supported, 398
      SSLServerSocket class, 408
      SSLSocket class, 397-400
CipherInputStream class, 99
CipherOutputStream class, 99
classes, 71
      applets and, 267-300
      authentication and, 228-235, 397-403
      callbacks and, 133
      compression/decompression, 96
      content handlers and, 565-578
      datagrams and, 413-434
      deadlock and, 144
      email and, 635-710
      encryption and, 397-403
      HTML, parsing, 248-266
      immutability and, 143
      input, 80-84
      of IP addresses, 32-34
      IP addresses and, 167-180
      loading at runtime, 609-617
      multicast, 461-466
      network, 24
      polymorphism and, 76
      protocol handlers and, 534-540
      readers/writers, 101-116
      reading/writing data types, 93-96
      retrieving data with URLs, 193-223
      RMI and, 617-633
      sockets
            client, 304-329, 393-397
            server, 351-364, 403-410
      streams, encrypting, 99
      synchronization and, 139
      URLs and, 472-528
clients, 2
      applet for remote object, example programs, 610
      application for remote object, example programs, 613-615
      downloading objects from servers, 609
      email, example programs, 664, 705-708
      multicasting and, 457
      POP, example program, 657
      POP3, example program, 652
      RMI, implementing, 605-607, 609
      sockets for, 301-330
      testing with server, example program, 365-368
client/server model, 37-39
clone() (UnicastRemoteObject), 632
close()
      DatagramSocket class, 430
      Folder class, 651, 698
      MulticastSocket class, 461
      OutputStream class, 80
      ServerSocket class, 360
      Socket class, 322
code base, applet displaying, 268
Common Gateway Interface (see CGI)
Common Object Request Broker Architecture (CORBA), 598
compressing streams, 96
com.sun.mail.imap.IMAPStore package, 635
com.sun.net.ssl package, 391
connect()
      Store class, 650
      URLConnection class, 474
connected field (URLConnection), 488
connection trees, 452
constants
      ImageObserver interface, 280
      MediaTracker class, 296
constructing HTML interfaces, 242
constructors
      ContentHandler class, 565
      DatagramPacket class, 414-417
      DatagramSocket class, 423-426
      InternetAddress class, 659
      JEditorPane class, 239
      MediaTracker class, 283
      Message class, 666
      MulticastSocket class, 462
      NewsAddress class, 661
      RemoteServer class, 629
      ServerSocket class, 352-355
      Socket class, 304-329
      UnicastRemoteObject class, 631
      URLConnection class, 474
      URLName class, 663
      URLStreamHandler class, 534
containsAttributes() (AttributeSet), 260
content handlers, 560-565
      example programs, 567, 570, 580, 584-588, 591-593
            time protocol, 573-577
      for image files, 581-593
      MIME types and, 562
      return types, choosing, 572-578
      for tab-separated-values content type, 566-568
      URLConnection class, 503-505
      using in programs, 568-571
ContentHandler class, 561, 565
      methods, 563
ContentHandlerFactory interface, 563
      method, 578-579
ContentHandlerFactory() (URLConnection), 505
converting URLs, relative to absolute, 262-265
COORDS keyword, 583
copyAttributes() (AttributeSet), 261
copyMessages() (Folder), 700
CORBA (Common Object Request Broker Architecture), 598
create() (Folder), 699
createContentHandler() (ContentHandlerFactory), 563, 578-579
createRegistry() (LocateRegistry), 628
createServerSocket() (SSLServerSocket), 403
createSocket() (SSLFactorySocket), 393
createURLStreamHandler()
      URLConnection class, 531
      URLStreamHandlerFactory interface, 556
creating
      sockets
            secure client, 393-397
            secure server, 403-408
      URLs, 194-203

D

data
      buffering, 78
      displaying, 2-8
      multicast, 457
      reading from servers, 475
      receiving, example program, 419
      retrieving, 2-8
            from URLs, 209-214
            with URLs, 193-235
      sending, 8-10
            with POST, 498
      writing to servers, 497-503
data streams, 93-96
data types, 76
      reading/writing, 93
databases
      content handlers and, 566
      interface to, example program, 618
DatagramPacket class, 412
      constructors, 414-417
      methods, 418-422
datagrams, 26, 301
      receiving, 426-431
            constructors for, 415
      (see also UDP)
      sending, 426-431
            constructors for, 416
      TTL value, 454, 458
      unused at socket close, 327
DatagramSocket class, 412, 423
      constructors, 423-426
      methods, 426-434
DatagramSocket() (DatagramSocket), 423
DataInputStream class, 93, 94
DataOutputStream class, 93
daytime program, example server program, 444
daytime protocol
      example program, 314
      server running, example program, 357
      writing handler for, 547-550
deadlock, 144
defaultAllowUserInteraction field (URLConnection), 490
defaultUseCaches field (URLConnection), 495
DeflaterOutputStream class, 96
DELETE (HttpURLConnection), 513
delete() (Folder), 700
dialog box, authentication, 231-235
DigestInputStream class, 98
DigestOutputStream class, 98
digital signatures, returning, 528
disconnect() (DatagramSocket), 432
displaying
      code base, applet for, 268
      data, 2-8
      document base, applet for, 268
      Fibonacci numbers, example program, 242
      images, example program, 270
      URLs, example program, 268
      web pages, example program, 239
DNS (Domain Name System), 165-166
      RFC about, 44
document base, applet displaying, 268
documents
      collaborating on, 19
      modified, checking, 492
doInput field (URLConnection), 491
Domain keyword, 339
Domain Name System (see DNS)
doOutput field (URLConnection), 491
downloading
      audio clips, 276
      images
            applet for, 269-271
            error checking, 294
      monitoring process of
            ImageObserver interface, 276-281
            MediaTracker class, 281-297
      sounds, 272-276
            via relative URLs, example program, 275
      URL objects, example program, 213
      web pages, example programs, 210, 475

E

echo protocol
      client
            example program, 320
            implementing with UDP, 445-449
      server, example program, 443
e-commerce, 16-17
email, 634-637
      addresses, 658-662
      attachments, 690-695
      creating, 666
      event handling, 709-710
      flags, 673-677
      folders, 677, 697-709
      format of, RFC about, 43
      headers, 667-673
      parts of, 679-690
      password authentication, 654-658
      receiving, 648-654
      sending, 637-640
            from applets, 644-648
            from applications, 641-644
      URLs and, 662-665
encode() (URLEncoder), 219-223
encryption, 389
      asymmetric, 390
      streams, 99-101
END keyword, 583
equals()
      Address class, 658
      InetAddress class, 179
      InternetAddress class, 660
      NewsAddress class, 662
      Object class, 216
      RemoteObject class, 628
      URLName class, 664
      URLStreamHandler class, 539
event handlers, secure sockets and, 400
exceptions
      datagrams and, 424, 431
      input/output and, 78
      IP addresses and, 168
      network connections and, 91
      race conditions and, 127
      remote, 624-626
      RMI and, 616, 632
      sockets and, 305, 309, 329, 352, 354, 400
      thread scheduling and, 150
exists() (Folder), 698
Expand keyword, 339
exportObject() (UnicastRemoteObject), 602, 632
expunge() (Folder), 700
Extensible Markup Language (XML), 57

F

fetch() (Folder), 703
Fibonacci numbers, example programs, 242, 601, 603, 605
File Transfer Protocol (FTP), RFC about, 44
FileNameMap() (URLConnection), 487
files
      binary, downloading, 478
      deleting, from URLs, 513
      gzipping, example programs, 160-163
      image, content handler for, 581-593
      modified, checking, 492
      pointed to by URLs, 539
      putting on web servers, 514
      sending from HTTP server, example program, 370-373
      storing, 8
      URL objects pointing to, testing, 215
filter streams, 84-87
finalize() (Folder), 710
finger, 330
      client, example program, 332
      writing protocol handler for, 542-546
firewalls, 34
FITS (Flexible Image Transport System) files
      content handler for, 581-593
      keywords in, 581
flush()
      OutputStream class, 79
      ParserCallback class, 251
Folder class, 697-704, 710
FolderListener interface, 710
forms
      compared to Java network programming, 3, 5, 8, 16, 238
      posting, 502
FTP (File Transfer Protocol), RFC about, 44
Full keyword, 339
full-duplex connections, 302

G

games, 11
Gateway keyword, 339
GET (URL), CGI and, 70, 221, 223-228, 492, 497
getAddress()
      DatagramPacket class, 418
      InetAddress class, 174, 177
      InternetAddress class, 660
getAllByName() (InetAddress), 171
getAllHeaderLines() (MimeMessage), 696
getAllHeaders() (Part), 684
getAllowUserInteraction() (URLConnection), 486, 488
getAllRecipients() (Message), 669
getAppletContext() (AppletContext), 297
getAttributeCount() (AttributeSet), 260
getAttributeNames ) (AttributeSet), 261
getAudioClip() (Applet), 273-275
getAuthority() (URL), 206
getBodyPart() (Multipart), 691
getByName() (InetAddress), 168
getCertificates() (JarURLConnection), 528
getClientHost() (RemoteServer), 630
getCodeBase()
      Applet class, 268
      getAudioClip() and, 274
      getImage() and, 271
      play() and, 273
      URL class, 202
getContent()
      ContentHandler class, 563, 565, 572
      Part interface, 688
      URL class, 212, 214, 569
      URLConnection class, 503, 530, 569
getContentEncoding() (URLConnection), 480
getContentID() (MimeMessage), 696
getContentLanguage() (MimeMessage), 696
getContentLength() (URLConnection), 477
getContentType()
      Multipart class, 691
      Part interface, 688
      URLConnection class, 477
getCount() (Multipart), 691
getData() (DatagramPacket), 418
getDataHandler() (Part), 688
getDate() (URLConnection), 480
getDefault()
      SSLFactorySocket class, 393
      SSLServerSocketFactory class, 403
getDefaultAllowUserInteraction() (URLConnection), 487
getDefaultPort() (URLStreamHandler), 538
getDefaultUseCaches() (URLConnection), 487
getDescription() (Part), 679
getDisposition() (Part), 679
getDocumentBase()
      Applet class, 268
      getAudioClip() and, 274
      getImage() and, 271
      play() and, 273
      URL class, 202
getDoOutput() (URLConnection), 486
getEnabledCipherSuites() (SSLSocket), 397
getEnableSessionCreation() (SSLSocket), 402
getEncoding() (MimeMessage), 696
getEntryName() (JarURLConnection), 527
getErrorsAny() (MediaTracker), 295
getErrorsID() (MediaTracker), 295
getExpiration() (URLConnection), 480
getFile()
      URL class, 205
      URLName class, 663
getFileName() (Part), 679
getFileNameMap() (URLConnection), 487
getFlags() (Message), 673
getFolder()
      Folder class, 698
      Message class, 677
      Store class, 651
getFrom() (Message), 668
getFullName() (Folder), 699
getHeader() (MimeMessage), 696
getHeaderField() (URLConnection), 483
getHeaderFieldDate() (URLConnection), 485
getHeaderFieldInt() (URLConnection), 485
getHeaderFieldKey() (URLConnection), 483
getHeight() (ImageObserver), 277
getHost()
      NewsAddress class, 662
      URL class, 204
      URLName class, 663
getHostAddress()
      InetAddress class, 176
      URLStreamHandler class, 539
getHostName() (InetAddress), 175
getIfModifiedSince() (URLConnection), 486
getImage()
      Applet class, 269-271
      MediaTracker class, 286
getInetAddress()
      DatagramSocket class, 432
      InetAddress class, 174
      ServerSocket class, 361
      Socket objects, 311
getInputStream()
      Part interface, 688
      Socket class, 314
      URLConnection class, 530
getInstance()
      Cipher object, 99
      Session class, 638
getInterface() (MulticastSocket), 466
getJarEntry() (JarURLConnection), 527
getJarFile() (JarURLConnection), 527
getJarFileURL() (JarURLConnection), 527
getLastModified() (URLConnection), 481
getLineCount() (Part), 679
getLocalAddress()
      InetAddress class, 174
      InternetAddress class, 661
      Socket class, 312
getLocalHost() (InetAddress), 172
getLocalPort()
      DatagramSocket class, 431
      ServerSocket class, 361
      Socket class, 312
getMatchingHeaderLines() (MimeMessage), 696
getMessage() (Folder), 667, 703
getMessageCount() (Folder), 702
getMessageNumber()
      Folder class, 701
      Message class, 678
getMode() (Folder), 699
getName() (Folder), 699
getNewMessageCount() (Folder), 702
getNewsgroup() (NewsAddress), 662
getOutputStream()
      Socket class, 318-321
      URLConnection class, 530
      SSLSocket class, 393
getParent() (Folder), 699
getParser() (Parser), 250
getPassword() (URLName), 663
getPasswordAuthentication() (Authenticator), 654
getPath() (URL), 205
getPermanentFlags() (Folder), 709
getPersonal() (InternetAddress), 660
getPort()
      DatagramPacket class, 418
      DatagramSocket class, 432
      Socket class, 311
      URL class, 204
      URLName class, 663
getProperty() (ImageObserver), 277
getProtocol()
      URL class, 204
      URLName class, 663
getQuery() (URL), 206
getReceiveBufferSize()
      DatagramSocket class, 434
      Socket class, 328
getReceivedDate() (Message), 670
getRecipients() (Message), 669
getRef()
      RemoteObject class, 629
      URL class, 205
      URLName class, 663
getRegistry() (LocateRegistry), 627
getReplyTo() (Message), 668
getResolveParent() (AttributeSet), 261
getSecurityContext() (RMISecurityManager), 622
getSendBufferSize()
      DatagramSocket class, 434
      Socket class, 328
getSentDate() (Message), 670
getSeparator() (Folder), 699
getSession() (SSLSocket), 402
getSize() (Part), 679
getSoLinger() (Socket), 327
getSoTimeout()
      DatagramSocket class, 433
      ServerSocket class, 363
getStore()
      Folder class, 699
      Session class, 650
getSubject() (Message), 670
getSupportedCipherSuites() (SSLSocket), 397
getSystemResource() (URL), 203
getTimeToLive() (MulticastSocket), 466
getTTL() (MulticastSocket), 466
getType()
      Address class, 658
      Folder class, 699
      InternetAddress class, 660
      NewsAddress class, 662
getUnreadMessageCount() (Folder), 702
getURL() (URLConnection), 486
getURLName() (Folder), 699
getUseCaches() (URLConnection), 486
getUseClientMode() (SSLSocket), 403
getUserInfo() (URL), 206
getUsername() (URLName), 663
getWidth() (ImageObserver), 277
GIF format, downloading images in, 270
Group keyword, 339
guessContentTypeFromName() (URLConnection), 506
guessContentTypeFromStream() (URLConnection), 508
GZIPInputStream class, 96
GZIPOutputStream class, 96
gzipping files, example programs, 160-163

H

Handle keyword, 339
handshakeCompleted(), 400
HandshakeCompletedEvent class, 400
HandshakeCompletedListener interface, 400
hashCode()
      InetAddress class, 180
      InternetAddress class, 660
      NewsAddress class, 662
      Object class, 217
      RemoteObject class, 629
      URLName class, 664
      URLStreamHandler class, 540
hasNewMessages() (Folder), 702
HEAD (HttpURLConnection), 511
headers
      datagrams, 301
      email, 667-673, 683
            example program for reading, 670
      IP, TTL field, 458
      MIME, 476, 511
            commands supported, listing, 513
            configuring client request, 495-497
            fields in, 477-485
            inspecting, 472
            tracing, 515
Host keyword, 339
hostnames, IP addresses and
      comparing, 170
      example conversion program, 181-184
hosts, 21, 165
hostsEqual() (URLStreamHandler), 539
host-to-network layer, 24
HotJava
      content handlers and, 561
      protocols supported by, 194
HTML (Hypertext Markup Language), 49, 56
      attributes, 262
      class, 253-259
      Fibonacci numbers, displaying in, 242
      in JLabel, 237
      parsing, 253
      in Swing
            attributes, listing, 260-266
            case sensitivity, 237
            components, 236-238
            hyperlinks, handling, 243-246
            interfaces, constructing, 242
            parsing HTML, 247-266
            reading HTML, 246
            rendering HTML, 238-247
      tags
            attributes, determining, 260-266
            example programs for stripping, 251, 254, 256-259
HTTP (Hypertext Transfer Protocol), 49, 58-62
      authentication, 228
      response codes, 60-62
            table of, 518-522
      response codes, example program, 522
      RFC about, 45
      servers (see HTTP servers)
HTTP servers, 369
      files, sending, 370-373
      full-fledged, 380
            example programs, 380-387
      MIME headers, 476
            fields in, 477-485
            sent by, inspecting, 472
      redirecting requests, example program, 374-378
      responses from, handling, 516-525
HttpURLConnection subclass, 509
      request method, 510-515
      servers
            disconnecting from, 515
            handling responses from, 516-525
HyperlinkEvent object, 244
HyperLinkListener interface, 244
hyperlinks, handling with Swing, 243-246
hyperlinkUpdate() (HyperlinkListener), 244
Hypertext Markup Language (see HTML)
Hypertext Transfer Protocol (see HTTP)

I

IANA (Internet Assigned Numbers Authority), 21, 32
      multicast addresses and, 455
      RFC about, 42
ICANN (Internet Corporation for Assigned Names and Numbers), 32
IETF (Internet Engineering Task Force), 39
      RFCs, 39-46
ifModifiedSince field (URLConnection), 492
Image keyword, 583
ImageObserver interface, 276-279
ImageProducer interface, 581
images
      adding tags to, example program, 287-290
      displaying via URLs, example program, 270
      downloading
            applet for, 269-271
            error checking, 294
            monitoring progress of, 278, 281
imageUpdate() (ImageObserver), 277
implAccept() (ServerSocket), 364
InetAddress class, 167
      creating objects, 168, 172
            security issues, 172-174
InflaterInputStream class, 96
input streams, 80-84
input/output (see I/O)
InputStream class, 80-84
InputStream() (SSLSocket), 393
InputStreamReader subclass, 102, 105
interactive TV, 18
internationalization, 110
Internet, 32-36
      layer, 25-27
      protocols, RFC about, 42
Internet Assigned Numbers Authority (see IANA)
Internet Corporation for Assigned Names and Numbers (ICANN), 32
Internet Engineering Task Force (see IETF)
Internet Explorer, protocols supported by, 194
Internet Protocol (see IP)
InternetAddress class, 659-661
I/O (input/output), 75-116
      readers/writers, 101-116
      streams
            filter, 84-101
            input, 80-84
            output, 76-80
IP addresses, 27, 30, 165-167
      classes of, 32-34
      client sockets connected to, 311
      finding, example programs, 172, 176
      hostnames and
            comparing, 170
            example conversion program, 181-184
            finding, example program, 175
      InetAddress class and, 167
      printing, example program, 178
      used by server, 361
IP (Internet Protocol), 28-31
      header, TTL field, 458
      RFC about, 42
isBlock() (Tag), 253
isDefined() (AttributeSet), 260
isEqual() (AttributeSet), 261
isErrorAny() (MediaTracker), 294
isErrorID() (MediaTracker), 295
isExpunged()
      Folder class, 701
      Message class, 678
isMimeType() (Part), 688
isOpen() (Folder), 698
isPreformatted() (Tag), 253
isSet() (Message), 674

J

JAF (JavaBeans Activation Framework), 636
JAR archives, 525-528
JarURLConnection class, 525-528
Java Collections API, thread pooling and, 160
Java Content-Type Mappings, tables of, 506-508
Java Cryptography Extension (JCE), 99
Java Development Kit (JDK), protocols supported by, 194
Java programming language, versions of, xvii
Java Secure Sockets Extension (seeJSSE)
Java virtual machine (see JVM)
JavaBeans, 133
JavaBeans Activation Framework (JAF), 636
java.io package, reader/writer classes in, 102
JavaMail API, 634-637
      email
            addresses, 658-662
            attachments, 690-695
            creating, 666
            event handling, 709-710
            flags, 673-677
            folders, 677, 697-709
            headers, 667-673
            MIME, 695-697
            parts of, 678-690
            receiving, 648-654
            sending, 637-648
      Message class, 666-678
      password authentication, 654-658
      URLName class, 662-665
      Usenet, accessing, 661-662
java.net package, 473
java.net.URL package, 194
java.rmi package, 600, 617-624
      remote exceptions, 624-626
java.rmi.registry package, 600, 626-628
java.rmi.server package, 600, 628-632
      exceptions, table of, 632
java.util.jar package, 528
java.util.security package, 98
java.util.Vector package, thread pooling and, 160
java.util.zip package, 96
javax.mail package, 635
javax.mail.Folder package, 635
javax.mail.InternetAddress package, 635
javax.mail.Message packages, 635
javax.mail.MimeMessage package, 635
javax.net package, 391
javax.net.ssl package, 391
javax.security.cert packages, 391
javax.swing.text.html package, 236
javax.swing.text.html.parser package, 236
JCE (Java Cryptography Extension), 99
JDK (Java Development Kit), protocols supported by, 194
JEditorPane class
      displaying web pages with, 239
      HTML and, 238-247
Jini, 18
JLabel (Swing), including HTML in, 237
join() (Thread), 151
joinGroup() (MulticastSocket), 461, 463
JPasswordField component (Swing), 231
JPEG format, downloading images in, 270
JSSE (Java Secure Sockets Extension), 389
      packages, 391
JVM (Java virtual machine)
      protocols supported by, 194, 198
      RMI and, 594
      stubs and, 621

K

keytool program, 404, 407
keywords
      BITPIX, 582
      COORDS, 583
      END, 583
      in FITS files, 581
      Image, 583
      NAXIS, 582
      OBSTIME, 583
      SIMPLE, 582
      synchronized, 139
      TELESC, 583
      this, 141
      for whois protocol, 339

L

leaveGroup() (MulticastSocket), 461, 464
LineNumberReader class, 109
list()
      Folder class, 701
      Naming class, 618
      Registry interface, 626
listSubscribed() (Folder), 701
LocateRegistry class, 627
log files on web servers, example program for processing, 184-192
lookup()
      Naming class, 605, 620
      Registry interface, 626
LookupThread class, example program, 190

M

Macintosh Runtime for Java, protocols supported by, 194
mail (see email; Java Mail API)
Mailbox keyword, 339
MailEvent class, 709
man-in-the-middle attacks, 390
mark()
      InputStream class, 84
      Reader class, 105
markSupported() (InputStream), 84
match() (Message), 678
MBONE (Multicast Backbone on the Internet), 457
MediaTracker class, 281-297
      constants, 296
      constructor, 283
Message class, 666-678
message digests, 98
MessageDigest class, 98
MIDI Type 0/1 formats, downloading sounds in, 272
MIME (Multipurpose Internet Mail Extension), 49, 63-68
      content types, 63-66
      email, 695-697
      headers, 476, 511
            client request, configuring, 495-497
            commands supported, listing, 513
            fields in, 477-485
            inspecting, 472
            printing, example program, 483
            tracing, 515
      RFC about, 45
      types
            text/tab-separated-values, content handler for, 566-571
            x-types, 66-68
            (see also content handlers)
      types, guessing, 506-509
MimeBodyPart class, 690
MimeMessage class, 666, 695
      sending email and, 639
MimeMultipart class, 690
mobile agents (see agents)
MUD (Multi-User Dungeon), 11
Multicast Backbone on the Internet (MBONE), 457
multicasting, 451-453
      addresses, 454-457
            permanent, 455-457
      clients and servers, 457
      groups, 454-457
            communicating with, 463-466
            example sniffer program, 467
            sending data to, example program, 470
      routers and, 459-461
MulticastSocket class, 461
      constructors, 462
      methods, 463-466
MulticastSocket() (MulticastSocket), 462
Multipart class, 690
Multipurpose Internet Mail Extension (see MIME)
multitasking, downloading and, 277
multithreading, 117-164
      (see also threads)
Multi-User Dungeon (MUD), 11
MutableAttributeSet class, 260, 262

N

Nagle's algorithm, 326
Name keyword, 339
Naming class, 618-621
NAXIS keyword, 582
Netscape Navigator, protocols supported by, 194
Netscape Open Directory, looking up topics in, 227
Network keyword, 339
Network News Transfer Protocol (NNTP), RFC about, 44
networks, 1-19, 20-28
      addresses (see IP addresses)
      applets and, 267-300
      hosts (see hosts)
      interfaces, client sockets bound to, 312
      layers of, 22-28
      nodes (see nodes)
      ports (see ports)
newAudioClip() (Applet), 276
newLine() (BufferedWriter), 109
NewsAddress class, 661-662
newsgroups, accessing with JavaMail API, 661
NNTP (Network News Transfer Protocol), RFC about, 44
nodes, 20, 165
notify() (Object), 154
notifyAll() (Object), 154
nslookup utility, 181

O

Object class, 216
objects
      remote, 595
            available to clients, 627
            binding, 620, 627
            compared to local, 597
            releasing, 620
            URLs bound to, 620
            URLs of, 627
      stubs, 599
            applets and, 621
            compiling, 607
            RMISecurityManager permissions, 622-624
      synchronization and, 139
      threads waiting on, 153-156
      (see also RMI)
OBSTIME keyword, 583
Open Systems Interconnection (OSI), network layer model, 24
open() (Folder), 651
openConnection(), 474
      URLConnection class, 211
      URLStreamHandler class, 531, 540
openStream() (InputStream), 209
OPTIONS (HttpURLConnection), 512
Organization keyword, 339
OSI (Open Systems Interconnection), network layer model, 24
OutputStream class, 76-80
OutputStreamWriter subclass, 102, 104

P

packets, 21, 301
parallel computing, 9
parse()
      InternetAddress class, 660
      NewsAddress class, 662
      Parser class, 249
Parser class, 248-250
ParserCallback class, 248, 250-253
ParserDelegator subclass, 248
parseURL() (URLStreamHandler), 534-536
parsing HTML, with Swing, 247-266
Part interface, 678-690
Partial keyword, 339
PasswordAuthentication class, 230, 654
passwords
      authenticating, 228-235
      email, 654-658
payloads, datagrams, 301
Person keyword, 339
PersonalJava, 18
play() (Applet), 272
plug-ins, 560
      (see also content handlers)
PNG format, downloading images in, 270
polling threads, 127
ports, 30
      assigned to protocols, table of, 31
      client sockets connected to, 311
      connections to, example programs for determining, 305, 307, 323
      listening on, determining which, 361
      looking for, example program, 353
      for protocols, returning default, 538
      UDP, example program for scanning, 424
POST (URL), 503
      CGI and, 70
      sending data with, 498
prepareImage() (ImageObserver), 277
PrintStream class, 89-91
PrintWriter class, 110
      implementation for network programming, 111-116
programming examples
      animator applet, 291-293
      authentication
            GUI for, 655
            POP client, 657
      authentication dialog, 231-235
      callbacks, 129-136
      characters in URLs, converting, 219
      client sockets, getting information about, 312
      clients
            email, 664
            POP3, 652
            for remote object, 610, 613-615
      content handlers, 567, 570, 580
      database interface, 618
      DatagramPacket, constructing, 419
      daytime protocol, reading time from, 314
      echo
            client, 320, 445
            server, 443
      email
            attachments, 691-694
            attributes, 681-683
            client, 705-708
            flags, reading, 674-677
            headers, reading, 670, 685-687
            sending, 640, 641-643, 645-647
      Fibonacci numbers
            displaying in HTML, 242
            interface, 601, 603, 605
      files
            downloading, 478
            gzipping, 160-163
      finger, command-line client, 332
      forms, posting, 500
      getParser(), making public, 250
      hostnames
            converting from IP addresses, 181-183
            finding from IP addresses, 175
      HTML
            converting to text, 251, 254, 256-259
            including in a JLabel, 237
            stripping tags, 251, 254, 256-259
      HTTP
            client, 395
            response codes, 522
      HyperLinkListener interface, implementation of, 244
      ifModifiedSince, setting, 493
      images, 278
            content handler, 584-588, 591-593
            displaying via URLs, 270
            downloading, 281
      IP addresses, 179
            converting to hostnames, 181-183
            finding, 172, 176
            finding from hostnames, 175
            printing, 178
      LookupThread class, 190
      MIME headers, printing, 483
      Multicast Sniffer, 467
      MulticastSender, 470
      Netscape Open Directory, looking up topics in, 227
      ports
            connections to, determining, 305, 307, 323
            looking for, 353
      PrinterWriter class, implementation for network programming, 111-116
      protocol handlers
            for chargen, 551-554
            for daytime, 548, 550
            for finger, 543
      protocols supported, determining, 195, 198
      QueryString class, 222
      race conditions, avoiding, 152
      RMI, debugging program, 619
      secure orders, 404-406
      servers
            daytime, 357
            HTTP, 370-373, 374-378, 380-387
            testing clients, 365-368
            time, 359
      sounds
            downloading via URLs, 275
            playing, 272
      stream handlers
            for finger, 545
            for mailto, 541
      tags, adding to images, 287-290
      Thread, subclassing, 120
      threads
            preemptive scheduling, 158
            returning information from, 124-126
      time protocol
            client, 316-318
            content handler for, 573-577
      UDP
            client, 436-438
            daytime server, 444
            discard client, 427
            discard server, 429, 441-443
            scanning for ports, 424
            server, 440
            time client, 438-440
      URL objects
            comparing, 217
            downloading, 213
      URLConnection, interacting with users, 489
      URLs
            printing, 487
            reading from command line, 481
            redirecting requests to/from, 298
            time when changed, 511
      URLs, relative
            converting to absolute, 262-265
            converting to web pages, 200
      URLStreamHandlerFactory, 557
      web browser, writing with Swing, 245
      web pages
            displaying with JEditorPane, 239
            downloading, 210, 475
      web server log files, 139
            processing, 186, 188
      web sites, password-protected, accessing, 228-235
      whois
            client GUI, 343-348
            command-line client, 337-338
            reusable class, 340-342
protocol handlers, 472, 529-534
      adding support for protocols, 194
      content handlers and, 563
      methods for, 217
      writing, 542-546
            chargen protocol, 550-555
            daytime protocol, 547-550
protocols, 22
      adding support for, 531
      content handlers and, 563
      email, 634, 636
            Java providers for, 637
            receiving, 648
      handling (see protocol handlers)
      investigating with telnet, 302-304
      port assignments for, 31
      supported by JVMs, 194
            example program for determining, 195, 198
proxy servers, 34-36
public key encryption, 389
PushbackInputStream subclass, 92
PushbackReader class, 110
PUT (HttpURLConnection), 514

Q

QueryString class, example program, 222

R

race conditions, 126
      avoiding, example program, 152
read()
      DataInputStream class, 95
      InputStream class, 80
      JEditorPane class, 246
      PushbackInputStream class, 92
      Reader class, 105
      Socket class, 327
Reader class, 101, 104
readers/writers, 101-106
      buffering, 106-109
readFully() (DataInputStream), 95
reading HTML in Swing, 246
readLine()
      DataInputStream class, 95
      LineNumberReader class, 109
ready() (Reader), 105
rebind()
      Naming class, 621
      Registry interface, 626
receive()
      DatagramSocket class, 428
      MulticastSocket class, 461
Registry interface, 626
Remote interface, 601, 617
Remote Procedure Calls (RPC), 596
RemoteObject class, 628
RemoteServer class, 629
      logging, 630
removeAttributes() (MutableAttributeSet), 262
removeBodyPart() (Multipart), 695
removeHandshakeCompletedListener() (HandshakeCompletedListener), 401
removeHeader() (Part), 684
removeImage() (MediaTracker), 297
renameTo() (Folder), 700
reply() (Message), 667
request() (HttpURLConnection), 510-515
reset()
      InputStream class, 84
      Reader class, 105
RFCs (Requests for Comments), IETF, 39-46
RMF format, downloading sounds in, 272
RMI (Remote Method Invocation), 594, 597-600, 620-633
      classes, loading at runtime, 609-617
      debugging programs, example, 619
      implementing
            client side, 605-607, 609
            server side, 601-605, 608
      object serialization, 596
      security and, 595
      stubs, compiling, 607
RMISecurityManager class, 621
      methods, 621-624
      permissions, table of, 622-624
routers, multicasting and, 453, 459-461
RPC (Remote Procedure Calls), 596
run()
      Runnable interface, 122
      Thread class, 119
Runnable interface, 122-124

S

sameFile()
      URL class, 215
      URLStreamHandler class, 539
saveChanges() (Message), 673
scheduling threads
      blocking, 148
      joining threads, 151-153
      preemption, 146, 157
      priorities, 145
      sleeping, 149-150
      yielding, 148
search() (Folder), 705
searching the Web, 14
Secure Hash Algorithm (SHA), 98
Secure Sockets Layer (SSL), JSSE and, 389
security
      applets and, 72
      InetAddress objects, creating, 172-174
      man-in-the-middle attacks, 390
      RMI and, 595
      sockets and, 388-410
      URLConnection class and, 505
      URLStreamHandler classes and, 202
      (see also encryption; RMISecurityManager class)
send()
      DatagramSocket class, 426
      MulticastSocket class, 464
      Transport class, 639
servers, 2, 13
      clients
            downloading objects from, 609
            testing, 365-369
      daytime, example program, 357
      disconnecting from, 515
      handling responses from, 516-525
      multicasting and, 457
      proxy
            HttpURLConnection subclass, 525
            (see also proxy servers)
      reading data from, 475
      RemoteServer class, 629-631
      RMI, implementing, 601-605, 608
      sockets for, 350-364
      time, example program, 359
      writing data to, 497-503
ServerSocket class, 302, 351
      constructors, 352-355
      methods, 361
ServerSocket() (ServerSocket), 352-355
servlets
      communicating with, 223-228
      games and, 14
      limitations of, 68
set() (URL), 217
setAddress()
      DatagramPacket class, 421
      InternetAddress class, 660
setAllowUserInteraction() (URLConnection), 486, 488
setContent() (Part), 690
setContentHandlerFactory()
      ContentHandlerFactory interface, 563
      URLConnection class, 579
setContentLanguage() (MimeMessage), 696
setData() (DatagramPacket), 421
setDefaultAllowUserInteraction() (URLConnection), 487
setDefaultUseCaches() (URLConnection), 487
setDoOutput() (URLConnection), 486
setEnabledCipherSuites() (SSLSocket), 397
setEnableSessionCreation() (SSLSocket), 402
setFileNameMap() (URLConnection), 487
setFlags()
      Folder class, 708
      Message class, 674
setFrom() (Message), 639, 668
setHeader() (Part), 684
setHost() (NewsAddress), 662
setIfModifiedSince() (URLConnection), 486
setImageObserver() (ImageObserver), 277
setInterface() (MulticastSocket), 465
setLength() (DatagramPacket), 422
setMessageNumber() (Message), 678
setNewsgroup() (NewsAddress), 662
setPersonal() (InternetAddress), 660
setPort() (DatagramPacket), 422
setReceiveBufferSize()
      DatagramSocket class, 434
      Socket class, 328
setRecipient() (Message), 639
setRecipients() (Message), 669
setReplyTo() (Message), 668
setResolveParent() (MutableAttributeSet), 262
setSendBufferSize()
      DatagramSocket class, 434
      Socket class, 328
setSentDate() (Message), 670
setSocketFactory() (ServerSocket), 364
setSoLinger() (Socket), 327
setSoTimeout()
      DatagramSocket class, 432
      ServerSocket class, 363
      Socket class, 327
setSubject() (Message), 639, 670
setTcpNoDelay() (Socket), 326
setText()
      MimeMessage class, 697
      Part interface, 689
setTimeToLive() (MulticastSocket), 466
setURL() (URLStreamHandler), 537
setURLStreamHandlerFactory()
      URL class, 217
      URLStreamHandlerFactory interface, 533
setUseCaches() (URLConnection), 486
setUseClientMode() (SSLSocket), 402
SGML (Standard Generalized Markup Language), 56
SHA (Secure Hash Algorithm), 98
showDocument() (AppletContext), 298
shutdownInput() (Socket), 324
shutdownOutput() (Socket), 324
SIMPLE keyword, 582
Simple Mail Transfer Protocol (SMTP), RFC about, 43
skip() (InputStream), 83
sleep() (Thread), 149
SO TIMEOUT socket option, 327
      server, 362
Socket class, 302
      constructors, 304-329
Socket() (Socket), 305-309
      protected, 309
sockets
      client, 302
            closing, 322-325
            creating secure, 393-397
            exceptions, 329
            getting information about, 311-322
            options, setting, 325-329
      datagram, 411-449
            managing, 431
            options, 432-434
      datagrams and, 413-426
      multicast, 451-461
            working with, 461-466
      security and, 388-410
      server, 350
            accepting connections, 355-360
            closing connections, 360
            creating secure, 403-408
            options, 362-363
      unicast, 450
SO_KEEPALIVE socket option, 329
SO_LINGER socket option, 327
SO_RCVBUF socket option, 328, 433
SO_SNDBUF socket option, 328, 434
SO_TIMEOUT socket option, 432
sounds
      downloading, 272-276
            example program, 275
      playing, example program, 272
spiders, 14
spreadsheet programs, content handlers and, 566
SQLQuery() (Remote), 617
SSL (Secure Sockets Layer), JSSE and, 389
SSLContext object, 404
SSLFactorySocket class, 393
SSLServerSocket class, 408
SSLServerSocketFactory class, 403
SSLSession interface, 401
SSLSocket class, 397-403
SSLSocket subclass, 393
Standard Generalized Markup Language (SGML), 56
start() (Thread), 119
startHandshake() (SSLSocket), 402
statusAll() (MediaTracker), 296
statusID() (MediaTracker), 296
streams, 75
      buffering, 79, 87-89
      compressing, 96
      data, 93-96
      digest, 98
      encrypting, 99-101
      filter, 84-87
      input, 80-84
            content handlers and, 563
            sockets, reading data from, 314
      output, 76-80
            sockets, writing data to, 318-321
      unicast, 451
SUBdisplay keyword, 339
Summary keyword, 339
sun.net package, 473
sun.net.www.content package, 564
Swing
      authentication and, example programs, 231-235, 655
      components
            HTML on, 236-238
            JPasswordField, 231
      HTML in
            attributes, listing, 260-266
            case sensitivity, 237
            hyperlinks, handling, 243-246
            interfaces, constructing, 242
            JLabel, 237
            parsing, 247-266
            reading, 246
            rendering with JEditorPane, 238-247
      web pages, displaying with JEditorPane, 239
synchronization, threads, 136-143
      alternatives to, 142
      deadlock, 144
      synchronized blocks, 139-141
synchronized keyword, 139

T

Tag class, 253-259
TCP (Transmission Control Protocol), 411
      multicasting and, 457
      RFC about, 43
TCP/IP, 28-31
      network layers, 23-28
TCP_NODELAY socket option, 326
TELESC keyword, 583
telnet
      investigating protocols with, 302-304
      RFC about, 43
This, 150
this keyword, 141
Thread class, 119
      subclassing, 120-122
thread pools, 159-164
threads, 117-164
      joining, 151-153
      polling, 127
      returning information from, 124-135
            example program, 124-126
      running, 119-124
      scheduling
            blocking, 148
            preemption, 146, 157, 158
            priorities, 145
            sleeping, 149-150
            yielding, 148
      synchronization, 136-143
      synchronized blocks, 139-141
      waiting on objects, 153-156
time protocol, content handler for, example program, 573-577
time server, example program, 359
Time-To-Live (see TTL)
TLS (Transport Layer Security), 389
toExternalForm()
      URL class, 216
      URLStreamHandler class, 536
toString()
      Address class, 658
      Folder class, 710
      InetAddress class, 180
      InternetAddress class, 660
      NewsAddress class, 662
      Object class, 216
      RemoteObject class, 628
      ServerSocket class, 364
      Socket class, 325
      Tag class, 253
      URLConnection class, 505
      URLName class, 664
toStub() (RemoteObject), 629
toURL() (URL), 202
TRACE (HttpURLConnection), 515
Transmission Control Protocol (see TCP)
Transmission Control Protocol/Internet Protocol (see TCP/IP)
transport layer, 28
Transport Layer Security (TLS), 389
TTL (Time-To-Live), 454, 458
      values for datagrams from U.S., 458

U

UDP (User Datagram Protocol), 28-31, 411-413
      clients, 435-440
      discard client, example program, 427
      discard server, example program, 429
      implementing echo client with, 445-449
      multicasting and, 457
      RFC about, 42
      servers, 440-444
unbind()
      Naming class, 620
      Registry interface, 626
UnicastRemoteObject class, 602, 629, 631
uniform resource identifiers (see URIs)
uniform resource locators (see URLs)
uniform resource names (URNs), 52
      RFC about, 45
unread()
      PushbackInputStream class, 92
      PushbackReader class, 110
URIs (uniform resource identifiers), 50-52
      RFC about, 45
URL class, 193-218
      protocol handlers and, 530
url field, URLConnection class, 487
URL objects
      comparing, example program, 217
      downloading, example program, 213
      files, pointing to, testing, 215
      returning, methods for, 202
URLConnection class, 472
      client request MIME headers, configuring, 495-497
      connections
            configuring, 485-495
            opening, 473-475
      constructor, 474
      content handlers and, 503-505, 562, 579
      limitations of, 473
      methods, 474, 477-485, 505
      MIME types
            guessing, 506-509
      protected instance fields, 485-495
      protocol handlers and, 530
      security and, 505
      servers
            reading data from, 475
            writing data to, 497-503
URLDecoder class, 223
URLEncoder class, 219-223
URLName class, 662-665
URLs (uniform resource locators), 53
      absolute, constructing from relative, 199
      as array of strings, returning, 618
      characters in, converting, 219-223
      comparing, 539
      components of, 203
            combining into strings, 536
            example program, 207
            returning, 204-209
      connecting to, 540
      creating, 194-203
      deleting files on, 513
      displaying, applet for, 268
      downloading sounds via, 275
      email and, 662-665
      jar, 526
      objects bound to, 620
      options supported, determining, 512
      parsing, methods for, 534-540
      performing operations on, methods for, 215
      pointing to files, 539
      printing, example program, 487
      protocol handlers and, 530
      reading from command line, example program, 481
      redirecting requests to/from, example program, 298
      relative, 55
            converting to absolute, 262-265
            example program, 200
      remote objects
            binding, 620
            releasing, 620
      retrieving data
            from, 209-214
            with, 193-235
      RFC about, 45
      time when changed, example program, 511
URLStreamHandler class, 202
      constructor, 534
      methods, 534-542
      protocol handlers and, 530
URLStreamHandlerFactory interface, 556
      method, 556
      protocol handlers and, 530
URNs (uniform resource names), 52
      RFC about, 45
useCaches field (URLConnection), 494
Usenet, accessing with JavaMail API, 661
User Datagram Protocol (see UDP)
usernames, authenticating, 228-235
usingProxy() (HttpURLConnection), 525

V

versions of Java, xvii

W

W3C (World Wide Web Consortium), 39
      recommendations, 46
wait() (Object), 153
waitForAll() (MediaTracker), 291, 294
waitForID() (MediaTracker), 286, 290
WAV format, downloading sounds in, 272
web browsers in Swing, example program, 245
web pages
      displaying, with JEditorPane, 239
      downloading, example programs, 210
      URLs relative to, example program, 200
Web, searching, 14
web servers
      loading classes from, 609
      log files on, example program for processing, 184-192
      putting files on, 514
      (see also clients; servers)
web sites, password-protected, accessing, 228-235
WebCollab, 13
whiteboards, 11
whois, 333-337, 339
      client GUI, example program, 343-348
      command-line client, example program, 337-338
      whois class, example program, 340-342
World Wide Web Consortium (see W3C)
write()
      OutputStream class, 76
      PrintWriter class, 111
      Writer class, 102, 103
writeBytes() (DataOutputStream), 94
writeChars() (DataOutputStream), 94
Writer class, 101, 102
      synchronization and, 141
writeTo() (Multipart), 694
writeUTF() ( (DataOutputStream), 94

X

XBM format, downloading images in, 270
XML (Extensible Markup Language), 57

Y

yield() (Thread), 149

Z

ZipInputStream class, 96
ZipOutputStream class, 96



Return to Java Network Programming, 2nd Edition


[ Cafe au Lait | Java Network Programming Home Page | Examples | Corrections | Index | Order ]

Copyright 2000, 2001 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified January 21, 2001