The Internet's "killer app" is not the World Wide Web or Push technologies: it is humble electronic mail. More people use email than any other Internet application. As the number of email users swells, and as email takes on an ever greater role in personal and business communication, Internet mail protocols have become not just an enabling technology for messaging, but a programming interface on top of which core applications are built.Programming Internet Email unmasks the Internet Mail System and shows how a loose federation of connected networks have combined to form the world's largest and most heavily trafficked message system.Programming Internet Email tames the Internet's most popular messaging service. For programmers building applications on top of email capabilities, and power users trying to get under the hood of their own email systems, Programming Internet Email stands out as an essential guide and reference book. In typical O'Reilly fashion,Programming Internet Email covers the topic with nineteen tightly written chapters and five useful appendixes.Following a thorough introduction to the Internet Mail System, the book is divided into five parts:
- Part I covers email formats, from basic text messages to the guts of MIME. Secure email message formats (OpenPGP and S/MIME), mailbox formats and other commonly used formats are detailed in this reference section.
- Part II describes Internet email protocols: SMTP and ESMTP, POP3 and IMAP4. Each protocol is covered in detail to expose the Internet Mail System's inner workings.
- Part III provides a solid API reference for programmers working in Perl and Java. Class references are given for commonly used Perl modules that relate to email and the Java Mail API.
- Part IV provides clear and concise examples of how to incorporate email capabilities into your applications. Examples are given in both Perl and Java.
- Part V covers the future of email on the Internet. Means and methods for controlling spam email and newly proposed Internet mail protocols are discussed.
- Appendixes to Programming Internet Email provide a host of explanatory information and useful references for the programmer and avid user alike, including a comprehensive list of Internet RFCs relating to email, MIME types and a list of email related URLs.
The Internet's "killer app" is not the World Wide Web or Push technologies: it is humble electronic mail. More people use email than any other Internet application. As the number of email users swells, and as email takes on an ever greater role in personal and business communication, Internet mail protocols have become not just an enabling technology for messaging, but a programming interface on top of which core applications are built.Programming Internet Email unmasks the Internet Mail System and shows how a loose federation of connected networks have combined to form the world's largest and most heavily trafficked message system.Programming Internet Email tames the Internet's most popular messaging service. For programmers building applications on top of email capabilities, and power users trying to get under the hood of their own email systems, Programming Internet Email stands out as an essential guide and reference book. In typical O'Reilly fashion,Programming Internet Email covers the topic with nineteen tightly written chapters and five useful appendixes.Following a thorough introduction to the Internet Mail System, the book is divided into five parts:
- Part I covers email formats, from basic text messages to the guts of MIME. Secure email message formats (OpenPGP and S/MIME), mailbox formats and other commonly used formats are detailed in this reference section.
- Part II describes Internet email protocols: SMTP and ESMTP, POP3 and IMAP4. Each protocol is covered in detail to expose the Internet Mail System's inner workings.
- Part III provides a solid API reference for programmers working in Perl and Java. Class references are given for commonly used Perl modules that relate to email and the Java Mail API.
- Part IV provides clear and concise examples of how to incorporate email capabilities into your applications. Examples are given in both Perl and Java.
- Part V covers the future of email on the Internet. Means and methods for controlling spam email and newly proposed Internet mail protocols are discussed.
- Appendixes to Programming Internet Email provide a host of explanatory information and useful references for the programmer and avid user alike, including a comprehensive list of Internet RFCs relating to email, MIME types and a list of email related URLs.
eBook
Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
Related collections and offers
Overview
The Internet's "killer app" is not the World Wide Web or Push technologies: it is humble electronic mail. More people use email than any other Internet application. As the number of email users swells, and as email takes on an ever greater role in personal and business communication, Internet mail protocols have become not just an enabling technology for messaging, but a programming interface on top of which core applications are built.Programming Internet Email unmasks the Internet Mail System and shows how a loose federation of connected networks have combined to form the world's largest and most heavily trafficked message system.Programming Internet Email tames the Internet's most popular messaging service. For programmers building applications on top of email capabilities, and power users trying to get under the hood of their own email systems, Programming Internet Email stands out as an essential guide and reference book. In typical O'Reilly fashion,Programming Internet Email covers the topic with nineteen tightly written chapters and five useful appendixes.Following a thorough introduction to the Internet Mail System, the book is divided into five parts:
- Part I covers email formats, from basic text messages to the guts of MIME. Secure email message formats (OpenPGP and S/MIME), mailbox formats and other commonly used formats are detailed in this reference section.
- Part II describes Internet email protocols: SMTP and ESMTP, POP3 and IMAP4. Each protocol is covered in detail to expose the Internet Mail System's inner workings.
- Part III provides a solid API reference for programmers working in Perl and Java. Class references are given for commonly used Perl modules that relate to email and the Java Mail API.
- Part IV provides clear and concise examples of how to incorporate email capabilities into your applications. Examples are given in both Perl and Java.
- Part V covers the future of email on the Internet. Means and methods for controlling spam email and newly proposed Internet mail protocols are discussed.
- Appendixes to Programming Internet Email provide a host of explanatory information and useful references for the programmer and avid user alike, including a comprehensive list of Internet RFCs relating to email, MIME types and a list of email related URLs.
Product Details
ISBN-13: | 9780596555672 |
---|---|
Publisher: | O'Reilly Media, Incorporated |
Publication date: | 08/01/1999 |
Sold by: | Barnes & Noble |
Format: | eBook |
Pages: | 380 |
File size: | 2 MB |
About the Author
Society for Human Resource Management (SHRM) is the world's largest association devoted to human resource management with more than 550 affiliated chapters and members in more than 100 countries.
Read an Excerpt
Chapter 11: The Post Office Protocol (Version 3)
In this chapter
- Using POP
- POP Commands
- POP Sessions
The Post Office Protocol (POP) is the older and simpler of the Internet's two mechanisms for retrieving electronic mail from a remote server. The other, the Internet Message Access Protocol (IMAP) is discussed in Chapter 12, The Internet Message Access Protocol (Version 4 Revision 1). POP and [MAP are both client/server systems that implement the concept of Mail Retrieval Agents, as described in Chapter 2, Electronic Mail on the Internet.
POP is the most mature of these two mechanisms. The current version of POP is version 3 (POP3), which is an Internet standard and has been assigned a designation of STD 53. IMAP, by comparison, is still a proposed standard.
This chapter describes POP3 in detail and provides information necessary to implement either POP servers or clients. There have been several enhancements proposed to extend POP's security options and these are also discussed.
Using POP
POP3 provides a standard mechanism for retrieving electronic mail from a remote server. The messages stored on the server may be deleted (as is usually the case), or retained. This allows many millions of home Internet users to have electronic mail sent to a mail server at their Internet service provider, then retrieve it when they are online. Small offices can use POP in the same manner to pull mail for many users from a mail server at a home office or an Internet service provider. These remote mail servers are known as maildrops. In short, any user that wishes to receive e-mail to their own machine or LAN but does not have a permanent Internet connection may use POP.A maildrop host must provide several services. It must include an SMTP MTA, providing mail services for all local users (if any) as well as for users for which it acts as a maildrop. The MTA must have access to at least one MDA for local message delivery. Chapter 2 described the relationship of MTAs and MDAs. In order for this machine to provide services as a POP maildrop, it must also include an MRA for POP services. This MRA would consist of a POP server capable of answering POP requests from authorized remote clients.
A POP server is a TCP application daemon that listens for POP requests on TCP port 110. This is called a 'well-known port'. Any POP client wishing to request service from a known host would connect to this port. The server would respond by spawning a new POP server instance on a high port number, communicating that instance port number to the client and return to listening on the well known port to handle other requests. The client would then connect to the instance port and begin the POP3 session communication. The instance server would be destroyed when the session is complete. In this way, one server daemon can handle many nearly-simultaneous requests from multiple clients. The mundane task of port switching is handled automatically in most languages when a socket is opened.
Networks services under Unix can either be run standalone, or arbitrated by the inet daemon. If a program is run continuously and listens for any incoming connections itself, it is a standalone service. The act of listening for incoming connections may be left to to the inet 'super-daemon', which will either start the necessary service or pass the request to a running service, thereby optimizing the use server resources.
Like other network services, POP3 daemons may be run either standalone or via the inet service.
MUAs that provide support for the POP3 protocol implement a POP3 client. A POP3 client may retrieve mail by initializing a connection to a POP server on the maildrop host. Figure 11-1 shows this behavior.
Figure 11-1. POP Usage for a Dial-in Host
The situation for a LAN that is intermittently connected to the Internet is slightly more complex. Instead of servicing a single user and thereby a single MUA, the machine that retrieves remote mail must serve many users on many machines.
An internal mailhost can use the POP3 protocol to retrieve mail from a maildrop on the Internet, as shown in Figure 11 -2. The Unix utility fetchmail is often used for this purpose, although there are other solutions. Fetchmail acts as a POP client, then remails each message to a local MTA, which delivers it to each user's mailbox. Of course, it is equally possible to write a utility that acts as a POP client and directly appends each message to each user's local mailbox.
Internal LAN users would then retrieve their mail in one of three ways; via an MUA on the local mailhost, via IMAP from an MUA on their own machine or again via POP from an MUA on their own machine.
Figure 11-2. POP Usage for a Dial-in LAN
Comparing POP and IMAP
The major difference between IMAP and POP is where mail is ultimately stored (and hence, how it is accessed). With POP, mail is transferred from a maildrop server to a local machine. IMAP, on the other hand, stores all messages on the maildrop. An IMAP-capable MUA passes messages back and forth to an IMAP maildrop to manipulate and view messages, but they are stored on the maildrop.POP is therefore much more efficient in terms of network bandwidth. Since messages are transferred from a maildrop, there will seldom be a requirement to duplicate the message transfer. If a user wishes to see a stored message again, they may simply retrieve it from local storage. An IMAP user would be forced to retrieve the message over the network, at least once per session. Also for this reason, POP MUAs can be substantially faster than their IMAP counterparts.
Security and privacy aspects are often important when dealing with e-mail messages. Many people are not comfortable with folders of private messages being stored on an Internet-connected server not under their direct control. After all, what you keep may reveal more about you than what you receive.
IMAP has its advantages, too. It was developed to support roaming users who connect from many different client machines. Storing mail on the server means that, once a user is properly authenticated, that user can get full access to all of their mail, both new and saved, regardless of the client that they happen to be using. It is a panacea for those that travel frequently and wish to maintain mail access without having to synchronize mailboxes later.
POP Commands
POP clients initiate every POP session. POP Servers just wait for clients to connect. POP clients issue all of the POP commands and servers respond to those commands.POP commands are case insensitive, although server responses are not.
When a client connects to a server, the server responds with a banner greeting. It looks like this:
Client: (Initiates socket connection) Server: +OK POP server ready
The first thing that a client must do upon connecting is to provide authentication for a particular user. That way, the server knows that it is safe to allow access to a given mailbox. This is known as the Authorization State. Commands that deal with user authentication are only valid in this state. The client can't do anything in this state except log in or quit.
User authentication commands and examples are shown in "The Authorization State.
Once a user is authenticated, the mailbox may be manipulated. This is known as the Transaction State. Commands that deal with a mailbox are only valid in this state, such as reading messages or moving them to other mailboxes. These commands and examples are shown in 'The Transaction State.
Once the client has issued a QUIT command (which tells the server that the client is finished with the session), a server enters the very brief Update State if any messages have been marked for deletion. At this time, any messages that were marked for deletion in the Transaction State are actually deleted. The server does not enter this state if no messages were marked for deletion.
Every command issued by a client yields a server response. Responses may be single line or multiline, but only as appropriate for the command given. Single line responses always consist of a status indicator ('+OK' or '-ERR') denoting a positive or negative response, an optional comment and a CRLF sequence. The status indicators must be given in upper case and the total line must not exceed 512 characters including the terminating CRLF.
The comments in the single line response are completely optional! Each POP server implementation may put in its own comments, so they cannot be relied upon when parsing server responses. The literal space that separates the status indicator from the comments is part of the comments, so it too may not be present. Some POP client implementations have relied on the space or specific comments, which is not portable.
Multiline responses are only appropriate if the command given demands a multiline response. Multiline responses consist of a single line response (status indicator, optional comment and CRLF), followed by the appropriate data in lines of no more than 512 total characters and ending with a '.' on a line by itself with a CRLF. That is, a sequence of CRLF.CRLF ends any multiline response. . . .
Table of Contents
- Table of Contents
- Preface
- 1. Introduction
- Anatomy of a Distributed Application
- Requirements for Developing Distributed Applications
- What Does Java Provide?
- Requirements for Developing Distributed Applications
-
- 2. Networking in Java
- Sockets and Streams
- URLs, URLConnections, and ContentHandlers
- The ClassLoader
- URLs, URLConnections, and ContentHandlers
-
- 3. Distributing Objects
- Why Distribute Objects?
- What's So Tough About Distributing Objects?
- Features of Distributed Object Systems
- Distributed Object Schemes for Java
- CORBA
- Java RMI
- RMI vs. CORBA
- What's So Tough About Distributing Objects?
-
- 4. Threads
- Thread and Runnable
- Making a Thread
- Managing Threads at Runtime
- Networked Threads
- Making a Thread
-
- 5. Security
- Security Issues and Concerns
- The java.security Package
- Identities and Access Control
- Keys: Public, Private, and Secret
- Digital Signatures
- Data Encryption
- Choosing a Cryptographic Algorithm
- The java.security Package
-
- 6. Message-Passing Systems
- Messages Defined
- Why Do We Need Messages?
- Message Processing
- Fixed Protocols
- Adaptable Protocols
- Message-Passing with Java Events
- Using Remote Objects
- Why Do We Need Messages?
-
- 7. Databases
- An Overview of JDBC
- Remote Database Applications
- Multi-Database Applications
- Remote Database Applications
-
- 8. Bandwidth-Limited Systems
- Flavors of Limited Bandwidth
- Coping with Limited Bandwidth
- Scope of This Chapter
- Monitoring Bandwidth
- Bandwidth Management
- Coping with Limited Bandwidth
-
- 9. Collaborative Systems
- What Is a Collaborative System?
- Issues with Collaboration
- A Basic Collaborative Infrastructure
- Issues with Collaboration
-
- 10. Building Collaborative Applications
- A Simple Chat System
- A Shared Whiteboard
-
- A. Using the Examples in Applets
- B. CORBA Services
- C. JavaSpaces
- D. RMI Quick Reference
- Index
- A. Using the Examples in Applets
A
abstract object interfaces, 7-8
acceptMove( ), 146
access control lists, 112-113
AccessDecision class, 327
AccessException, 336-337
Acl interface, 112-113
AclEntry class, 112-113
activation, dynamic, 54-55
adaptable message protocols, 163-172
addAgent( ), 266-267
addEntry( ), 112
addHandler( ), 178
addMessageType( ), 165
addPageElements( ), 252
addPermission( ), 112
addresses, IP, 23
addSample( ), 231
agents, 3-4
AgentConnection class (ex.), 262-267
AgentHandler class (ex.), 262-267
definition of, 3
identities for, 111-112, 268-269
collaboration and, 259-260
managing, 108
verifying, 105, 125-126
imposter, 104
algorithms, cryptographic, 106-107, 132-137
Diffie-Hellman technique, 114, 115, 134
DSA, 106-107, 134
presently available, 134-135
RSA public key encryption, 134-135
AlreadyBoundException, 337
applets, 311-317
downloading support classes for, 317
applications
collaborative (see collaborative systems)
distributed (see distributed applications)
assignmentsFor( ), 206
asymmetric encryption, 115, 127
asynchronous
agents, 94-95
communications, CORBA Event Service for, 321-325
message handling, 141
message passing, 142-143
audio, streaming (ex.), 244-251
AudioConsumer class (ex.), 244-247
AudioProducer class (ex.), 244-250
audit_needed( ), 327
AuditChannel interface, 327
AuditDecision interface, 327
auditing transactions (CORBA), 326
authenticate( ), 121, 131
authentication, 18-20
AuthAgent client (ex.), 121-122, 130-131
AuthCreditAgent client (ex.), 123-124
CORBA Security Service for, 326
digital signatures (see digital signatures)
one-, two-, many-way, 133
PGP for, 137
presently available techniques for, 135
B
bandwidth-limited systems
managing bandwidth, 229-230, 243-256
monitoring bandwidth, 229-243
types of, 228-229
BankServer interface (ex.), 59-60
BasicMessage class (ex.), 141-142
for heterogeneous argument lists, 155-157
Message class, 167-169
BasicMsgHandler class (ex.), 142-145
for heterogeneous argument lists, 159-160
(see MessageHandler class)
bind( )
Naming interface, 338
Remote interface, 344
bind_new_context( ), 320
binding objects, 319
broadcast( )
Collaborator interface, 270
Mediator interface, 270
RMICollaboratorImpl class (ex.), 287
broadcastCmd( ), 99
browser application example, 251-256
BufferedInputStream class, 18-19, 28
BufferedOutputStream class, 18-19, 28
BufferedReader class, 28
BufferedWriter class, 28
buffering data, 245-248
buildMessage( ), 142, 167
buildUI( ), 316-317
byte-oriented I/O, 28
ByteArrayInputStream class, 31
ByteArrayOutputStream class, 31
bytecodes, 8
C
caching database data, 210-212
CallableStatement class, 193
cancel( ), 335
CAs (certification authorities), 115, 125-126, 135
catch clause, 8
certification, 125
certification authorities (CAs), 115, 125-126, 135
digital signatures (see digital signatures)
distributing public keys, 125-126
presently available techniques for, 135
public key certificates, 115
CFDContentHandler class (ex.), 36-37
CFDContentHandlerFactory class (ex.), 37
character-based I/O, 28
CharArrayReader class, 31
CharArrayWriter class, 31
chat system (ex.), 293-296
checkAccept( ), 340
checkAccess( ), 340
checkAwtEventQueueAccess( ), 340
checkConnect( ), 340
checkCreateClassLoader( ), 340
checkDelete( ), 340
checkExec( ), 340
checkExit( ), 340
checkLink( ), 340
checkListen( ), 340
checkMemberAccess( ), 340
checkMulticast( ), 340
checkPackageAccess( ), 341
checkPackageDefinition( ), 341
checkPermission( ), 124
checkPrintJobAccess( ), 341
checkPropertiesAccess( ), 341
checkPropertyAccess( ), 341
checkRead( ), 341
checkSecurityAccess( ), 341
checkSetFactory( ), 341
checkSystemClipboardAccess( ), 341
checkTopLevelWindow( ), 341
checkWrite( ), 341
chess-playing agents example, 139
Chess...Event classes (ex.), 180-181
ChessEventServer class (ex.), 178-180
ChessMessage class (ex.), 148-151
ChessMove class (ex.), 160-161, 170
ChessPlayer class (ex.), 145-147
ChessServer class (ex.), 145, 151-152
fixed message protocol for, 145-162
Java events for, 178-181
RMI implementation of, 183-188
synchronous vs. asynchronous handling, 141
Cipher class, 127-128
classes
ClassLoader class, 38-44
object serialization versus, 75
ClassNotFoundException, 43-44
downloading for applets, 317
locking for threads, 92
references to, 47
clients
interface for object classes, 51
object stub, 51
IDL interface and, 61, 63-65
Java RMI and, 73
PipedClient class (ex.), 31-32
RunnableSolverClient class (ex.), 90-91
SimpleClient class (ex.), 12-15
code, obtaining online, xiii
collaborative systems
chat system (ex.), 293-296
Collaborator interface (ex.), 269-270, 282
collaborator requirements, 269
CollaboratorMessage class (ex.), 280-281
concerns with, 259-261
definition of, 257-259
infrastructure of, 261-292
with message passing, 261-282
MessageCollaborator interface (ex.), 276-280, 282, 311-317
with RMI, 282-292
shared whiteboard (ex.), 296-309
commit( ), 193
communication protocols, 5
complexity of cryptographic algorithms, 132
concede( ), 146
ConcedeMessage class (ex.), 151
configuring JDBC drivers, 195-196
ConfirmMoveMessage class (ex.), 150, 157
connect( ), 270
connect_pull_consumer( ), 325
connect_pull_supplier( ), 325
connect_push_consumer( ), 325
connect_push_supplier( ), 325
ConnectException, 337
ConnectIOException, 337
Connection interface, 192
constraintsFor( ), 206
consume( ), 242
consumeAll( ), 242
ConsumerAdmin interface, 324
consumers, event, 321-323
ContentConsumer class (ex.), 238-243
ContentHandler class, 36-37
ContentHandlerFactory class, 36-37
ContentProducer class (ex.), 238-243
CORBA, 58-71, 318-329
Event Service, 321-325
IDL (Interface Definition Language), 59-60
Solver interface (ex.), 62-63
Naming Service, 318-321
java.rmi.Naming versus, 320-321
ORB (Object Request Broker), 59
RMI versus, 81-83
Security Service, 326-328
CosEventChannelAdmin module, 324-325
CosEventComm module, 323-324
CosNaming module, 319
costs of cryptography, 133-134
createRegistry( ), 343
createServerSocket( ), 350
createSocket( ), 350
createStatement( ), 192
Credential class, 326-327
crypt( ), 127
cryptography
algorithms for, 106-107, 132-137
JCE (Java Cryptography Extension), 108
SSL for, 136
D
data
buffering, 245-248
caching, database objects and, 210-212
encrypting (see encryption)
marshaling, 50
multicasting, 26
partitioning and distributing, 4-5
raw throughput monitoring, 234-237
real throughput monitoring, 237-243
XDR-formatted (ex.), 29-30
DatabaseItem interface (ex.), 200-201
multiple Connection objects, 225-226
databases
defining data objects, 196-197
scheduling system example, 198-200
JDBC API, overview of, 189-194
multiple in applications, 225-227
ODBC drivers, 195-196
remote, 194-225
remote data servers and, 212-225
sample query, 190-191
scheduling system (ex.), 197-225
data caching, 210-212
with JDBC-enabled data objects, 200-210
DatagramPacket class, 25
DatagramSocket class, 24-26
DataInputStream class, 9-12, 28
DataMonitor class (ex.), 231-234
DataOutputStream class, 28
dcj.examples packages, xiii
dcj.utils packages, xiii
defocusElement( ), 253
delegation models, 173
destroy( ), 324
development tools for distributed object systems, 55
Diffie-Hellman encryption technique, 114, 115, 134
Digital Signature Algorithm (DSA), 106-107, 134
digital signatures, 108, 117-126
DII (Dynamic Invocation Interface), 58
disconnect_pull_consumer( ), 324
disconnect_pull_supplier( ), 324
disconnect_push_consumer( ), 324
disconnect_push_supplier( ), 323
dispatch( ), 351
distributed applications
anatomy of, 2-4
bandwidth-limited (see bandwidth-limited systems)
with databases (see databases)
requirements for development, 4-6
distributed certified public keys, 125-126
distributed computing
bandwidth-limited (see bandwidth-limited systems)
development tools for, 55
distribution of workload, 51
history of, ix-xi
Java's advantages in, 6-21
motivations for, 1
distributed events, 173-181
distributed objects, 46-51
databases and remote data, 215-225
Java schemes, 56-83
comparison between, 81-83
CORBA, 58-71
Java RMI, 71-81
JavaSpaces system, 330-335
system features, 51-55
distributed threads/ThreadGroups, 95-99
synchronizing, 101-102
distributeEvent( ), 178
distributing data and functions, 4-5
DistThreadGroup class (ex.), 95-99
DNS (Domain Name Service), 23
doConsume( )
AudioConsumer class, 246
ContentConsumer class, 242
Domain Name Service (DNS), 23
done( )
RemoteCall interface, 347
RemoteRef class, 348
DoneCmd class (ex.), 10-11
doProduction( )
AudioProducer class, 251
ContentProducer class, 242
downloading
applet support classes, 317
web pages (ex.), 251-256
Driver interface, 191
DriverManager class, 191
drivers, configuring, 195-196
DSA (Digital Signature Algorithm), 106-107, 134
DSAKeyPairGenerator interface, 107
dynamic database objects, 199
Dynamic Invocation Interface (DII), 58
dynamic object activation, 54-55
E
eavesdropping, 104, 126
encapsulation in database design, 196-197
encryption, 18-20, 108, 126-131
asymmetric algorithms, 115, 127
available techniques for, 134-135
EncryptedInputStream class (ex.), 19
PGP for, 136-137
public key, 114-116
SSL for, 136
symmetric algorithms, 127
entries, JavaSpace, 332
Entry class (JavaSpaces), 332
EntryReps class (JavaSpaces), 332
equals( )
ObjID class, 346
RemoteObject class, 347
UID class, 353
error handling, 8-9
Event Service (CORBA), 321-325
events
AWT, 181-183
distributed, 173-181
event channels, 321-323
quality of service, 323
EventChannel interface, 324
EventHandler interface (ex.), 177
EventListener interface, 173, 325
EventObject class, 173
EventTransceiver class (ex.), 174-178
message passing and, 173-183
example source code, obtaining, xiii
exception handling, 8-9
executeCall( ), 347
executeQuery( ), 192, 193
ExportException, 345
extendibility, 5
F
failure( ), 349
fault tolerance, 8-9
FilterInputStream class, 28-30
FilterOutputStream class, 28-30
FilterReader class, 28-30
FilterWriter class, 28-30
finalize( ), 13
finally blocks, 8
fixed message protocols, 145-162
flexibility, 5
for_consumers( ), 324
for_suppliers( ), 324
forName( ), 48, 191
FTP, obtaining source code via, xiii
fully qualified hostnames, 23
functions, partitioning and distributing, 4-5
G
generateKey( ), 117
generateKeyPair( ), 117
generating keys, 115, 116-117
getAddress( ), 23
getAlgorithm( ), 116
getAllResources( ), 204
getAllTasks( ), 204
getAverageRate( ), 231
getClientHost( )
RemoteServer class, 348
ServerRef interface, 351
GetCmd class (ex.), 10-11
getConnection( ), 190, 191
getConsumer( ), 256
getContent( ), 36
getCreditData( ) (ex.), 118
getDeclaredMethods( ), 49
getDefaultStream( ), 346
getFailureHandler( ), 350
getHostName( ), 23
getIdentity( ), 270
getInputStream( )
java.io package, 27
RemoteCall interface, 347
getInstance( ), 119
getLastRate( ), 231
getLog( ), 348
getName( ), 49
getOperation( ), 347
getOperations( ), 352
getOutputStream( )
java.io package, 27
LogStream class, 346
RemoteCall interface, 347
getPrivate( ), 116
getPublic( ), 116
getRateFor( ), 231
getRegistry( ), 343
GetResourceMsg class (ex.), 212-213
getResultStream( ), 347
getSecurityContext( )
LoaderHandler interface, 345
RMIClassLoader class, 349
RMISecurityManager class, 341
getSocketFactory( ), 350
H
handleEvent( ), 177, 325
hashCode( )
ObjID class, 346
RemoteObject class, 347
UID class, 353
HeadCmd class (ex.), 10-11
heterogeneous argument lists, 154-160
host computers, 23
HTMLPageLoader class (ex.), 252-256
HTTP protocol, 35
I
I/O (see network communications)
identifiers, message, 138-139
identity, agent, 111-112, 268-269
collaboration and, 259-260
managing, 108
verifying, 105, 125-126
Identity class (ex.), 111-112, 268-269
IDL (Interface Definition Language), 59-60
Solver interface (ex.), 62-63
IIOP (Internet Inter-ORB Protocol), 58
implementation-neutral interfaces, 7-8
implementation of object classes, 51
import statement, 38
imposter agents, 104
in keyword (IDL), 60
InetAddress class, 23
initEncrypt( ), 127
initialize( ), 116
initSign( ), 119
initStream( ), 41-43
initVerify( ), 120
inout keyword (IDL), 60, 64
InputStream classes, 27-35, 88
InputStreamReader class, 27
interactive chat system (ex.), 293-296
Interface Definition Language (IDL), 59-60
Solver interface (ex.), 62-63
interfaces, abstract (implementation-neutral), 7-8
Internet Inter-ORB Protocol (IIOP), 58
Internet Protocol (IP), 22-23
intruders, 105
invoke( ), 348
IP (Internet Protocol), 22-23
isAuthorized( ), 124
J
Java Cryptography Extension (JCE), 108
Cipher class, 127-128
Java language
advantages for distributed computing, 6-21
Java language (continued)
distributed object schemes, 56-83
comparison between, 81-83
CORBA, 58-71
Java RMI, 71-81
event model, 173, 325
multithreading support, 20-21
network support of, 9-18
as RMI's exclusive language, 81-83
security, 18-20, 105-106
Java RMI, 71-81
collaborating with, 282-292
CORBA versus, 81-83, 320-321
message passing with, 183-188
quick reference, 336-354
Registry, 72-73
security manager for, 74
Java Security API (java.security), 20, 106-111, 328
acl package, 112-113
Cipher class, 127-128
Key interface, 116-117
Java Virtual Machine (JVM), 8
java.io package, 9, 27-28
java.net package, 22, 35
java.rmi package, 336-343
java.rmi.Naming interface (see naming service)
java.rmi.registry package, 343-344
java.rmi.server package, 344-354
JavaSpace interface, 333-335
JavaSpaces system, 330-335
JCE (Java Cryptography Extension), 108
Cipher class, 127-128
JDBC API, 189-194
driver configuration, 195-196
JDBC-enabled data objects, 200-210
multi-database applications, 225-227
JIT (just-in-time) compilers, 82
joinGroup( ), 26
JVM (see Java Virtual Machine)
K
Key interface, 116-117
KeyGenerator class, 117
KeyPair class, 116
KeyPairGenerator class, 116
keys, 114-117
certified public, distributing, 125-126
public key encryption, 114-116
public key signatures, 119-121
public vs. private, 115
secret, 114
L
leaveGroup( ), 26
legal issues and cryptography, 133-134
licenses for cryptography, 133-134
limited bandwidth (see bandwidth-limited systems)
list( )
Naming interface, 338
Remote interface, 344
listen( ), 15
loadClass( )
ClassLoader class, 39, 43-44
LoaderHandler interface, 345
RMIClassLoader class, 349
loadElements( ), 253, 255
LoaderHandler interface, 345
loading classes, 38-44
object serialization versus, 75
LocateRegistry interface, 343
locking classes for threads, 92
log( ), 346
LogStream class, 345-346
lookup( )
Naming interface, 72-73, 338
Remote interface, 344
lookupSecretKey( ), 131
M
managing bandwidth, 229-230, 243-256
streaming audio example, 244-251
web browser example, 251-256
MarshalException, 337
marshaling data, 50
MD5 message digest format, 107
Mediator interface (ex.), 270-271
MediatorMessage class (ex.), 274-276
mediators, 261, 270-271
Message class (ex.), 167-169
message handlers, 140-145
adaptable, 164-172
asynchronous vs. synchronous, 141
example processor, 141-145
for heterogeneous argument lists, 159-160
MessageCollaborator interface (ex.), 276-280, 282
as applet, 311-317
MessageHandler class (ex.), 165-167
collaboration by using, 261-282
MessageMediator class (ex.), 271-274
as applet, 311-317
message-passing systems
advantages to, 140
chess-playing agents example, 145-162
collaborative, 261-282
databases and remote data, 212-215
Java events with, 173-183
remote objects for, 183-188
messages
adaptable message types, 164
adaptable protocols for, 163-172
definition of, 138-139
fixed protocols for, 145-162
heterogeneous argument lists, 154-160
identifiers for, 138-139
objects as arguments, 160-162
rationale for, 139-140
variable arguments, 163-164
methods
Method class, 49
public key, 114-116
remote invocation of, 48-50
synchronized, 92
monitoring bandwidth, 229-243
raw data throughput, 234-237
real data throughput, 237-243
monitoring sytem performance, 101
mouse events
browser example and, 256
whiteboard example and, 300-305
mouseDragged( ), 256
moveAccepted( ), 146
MoveMessage class (ex.), 149-150, 157-159
adaptable version of, 170-172
with object arguments, 160-162
MsgWhiteboardUser class (ex.), 312-316
multicast sockets, 26-27
multicasting, 26
MulticastSocket class, 26
multi-database applications, 225-227
multimedia, streaming (ex.), 244-251
multithreading (see threads)
multi-way agent authentication, 133
N
NameComponent class, 320
Naming interface, 72
quick reference for, 338
naming service, 51, 54-55
CORBA, 61, 70, 318-321
java.rmi.Naming vs. CORBA, 320-321
RMI Registry, 72-73
NamingContext interface, 319
network communications
ClassLoader class, 38-44
object serialization versus, 75
collaboration and, 259
eavesdropping on, 104, 126
HTTP protocol support, 35-38
Java support for, 9-18
multicasting, 26-27
object communication protocol, 55
protocol requirements, 5
remote transaction security, 18-20
sockets and streams, 22-35
threads and, 94-102
newCall( ), 348
newCopy( ), 167
newInstance( ), 48
newMember( ), 270
nextMove( ), 146
non-repudiation facilities (CORBA), 326
NoSuchObjectException, 339
NotBoundException, 339
notify( )
Collaborator interface, 270
JavaSpace interface, 335
NRCredentials interface, 327
O
Object Management Group (OMG), 58
object manager, 53-54
CORBA's ORB, 59
RMI Registry, 72-73
object references, 47-48
Object Request Broker (see ORB)
object-oriented programming, 7
objects, 3
abstract interfaces for, 7-8
binding, 319
client stub, 51
IDL interface and, 61, 63-65
Java RMI and, 73
of databases, defining, 196-197
scheduling system example, 198-200
distributed (see distributed objects)
dynamic activation, 54-55
interface specification, 51-53
as message arguments, 160-162
persistence, 328
registration/naming service, 51, 54-55
CORBA and, 61, 70
RMI Registry, 72-74
remote
communication protocol, 55
creating, 47-48
for message passing, 183-188
registering (RMI), 73-74
remote interfaces, 71
serializing, 47, 74-75, 332-333
server skeleton, 51
IDL interface and, 60-61, 65-69
Java RMI and, 73
verifying incoming, 105
ObjID class, 346
obtain_pull_consumer( ), 324
obtain_pull_supplier( ), 324
obtain_push_consumer( ), 324
obtain_push_supplier( ), 324
ODBC database drivers, 195-196
OMG (Object Management Group), 58
one-way agent authentication, 133
openConnection( ), 35-36
openStream( ), 35
Operation class, 346-347
ORB (Object Request Broker), 58-59
Internet Inter-ORB Protocol (IIOP), 58
out keyword (IDL), 60
OutputStream classes, 27-35, 88
OutputStreamWriter class, 27
P
parseClassName( ), 41-43
parseLevel( ), 346
partitioning data and functions, 4-5
performance
collaboration and, 260-261
distribution of workload, 51
monitoring, 101
multithreading and, 6
thread management, 21
thread priorities, 93-94, 100-101
PermissionImpl class, 112
permissions, adding to ACL entries, 112
persistent objects, 328
PGP (Pretty Good Privacy), 136-137
PipedClient class (ex.), 31-32
PipedInputStream class, 30-35
PipedOutputStream class, 30-35
PipedServer class (ex.), 33-34
platform independence, 8
Java RMI versus CORBA, 82
specifying object interfaces, 53
port numbers, 23
PostCmd class (ex.), 10-11
postConsume( ), 242
postProduction( ), 242
preConsume( ), 242
prepareCall( ), 192
PreparedStatement class, 193
prepareStatement( ), 192
preProduction( ), 242
Pretty Good Privacy (PGP), 136-137
Principal interface, 111-113
PrincipalAuthenticator interface, 326-327
PrincipalImpl class, 113
priorities, thread, 21, 93-94, 100-101
private keys, 115
PrivateKey class, 116
privileges for database objects, 199
ProblemSet interface (ex.), 56-57
in CORBA environment, 62-71
Runnable interface with, 85-91
using Java RMI, 75-81
processes, 2-3
processing messages (see message handlers)
produce( ), 242
produceAll( )
AudioProducer class, 250
ContentProducer class, 242
production pipelines, 243
provider API (java.security), 107
Provider interface, 107
ProxyPullConsumer interface, 325
ProxyPullSupplier interface, 325
ProxyPushConsumer interface, 325
ProxyPushSupplier interface, 325
pseudo-random number generator, 116
public keys
certificates, 115
digital signatures and, 119-121
distributing, 125-126
encryption, 114-116
PublicKey class, 116, 125-126
RSA encryption, 134-135
pull( ), 322
PullConsumer interface, 324
pull-style event suppliers, 321-323
PullSupplier interface, 324
push( ), 322
PushbackInputStream class, 28
PushbackReader class, 28
PushConsumer interface, 324
push-style event consumers, 321-323
PushSupplier interface, 323-324
Q
quality of service, event channel, 323
query service (CORBA), 329
query statements, 192-193
R
random number generator, 116
raw data throughput, 234-237
read( )
JavaSpace interface, 334
ObjID class, 346
UID class, 353
readArgs( ), 157-160
readClass( ), 41-43
Reader classes, 27-35
readMsg( ), 142, 154-155, 267
real data throughput, 237-243
real-time (see bandwidth-limited applications)
Real-Time Control Protocol (RTCP), 230
Real-Time Protocol (RTP), 230
rebind( )
Naming interface, 338
Remote interface, 344
receiveEvent( ), 178
registration service, 51, 54-55
CORBA and, 61, 70
RMI Registry, 72-74
Registry interface, 343-344
Registry, Java RMI, 72-73
RegistryHandler interface, 344
registryImpl( ), 344
registryStub( ), 344
RejectMoveMessage class (ex.), 150-151
releaseInputStream( ), 347
releaseOutputStream( ), 347
remote
database data servers, 212-225
databases, 194-225
method invocation, 48-50
object interfaces, 71
object references, 47-48
objects
communication protocol for, 55
creating, 47-48
for message passing, 183-188
registering (RMI), 73-74
remote (continued)
Remote interface, 71, 339
Remote Method Invocation (see Java RMI)
RemoteCall interface, 347
RemoteException, 71, 282, 333, 339
RemoteObject class, 347
RemoteRef interface, 348
RemoteServer class, 72, 348-349
RemoteStub class, 349
transaction security, 18-20
remoteEquals( ), 348
remoteHashCode( ), 348
remoteToString( ), 348
removeHandler( ), 178
removeMember( ), 270
renew( ), 335
ResAssignment class (ex.), 201, 206-209
resizeBuffer( ), 248-250
resolving object names, 319
ResultSet class, 190, 193-194
resume( ), 99
RMI (see Java RMI)
rmic compiler, 73
RMIChatClient class (ex.), 293-295
RMIChessMove interface (ex.), 183-184
RMIChessMoveImpl class (ex.), 184-185
RMIChessPlayer interface (ex.), 185
RMIChessPlayerImpl class (ex.), 185-188
RMIClassLoader class, 349
RMICollaborator interface (ex.), 282-283, 292
RMICollaboratorImpl class (ex.), 284-287, 292, 293, 297
RMIDatabaseItem interface (ex.), 215-216
RMIFailureHandler interface, 349
RMIMediator interface (ex.), 283-284, 292
RMIMediatorImpl class (ex.), 287-291, 296
rmiregistry command, 72
RMISchedDbase interface (ex.), 217
RMIScheduler class (ex.), 224-225
RMISecurityException, 340
RMISecurityManager class, 340-341
RMISocketFactory class, 350
RMISolver interface (ex.), 75-81
RmtThreadGroup class (ex.), 98-99
rollback( ), 193
RSA public key encryption, 134-135
RSAKeyPairGenerator class, 116
RTCP (Real-Time Control Protocol), 230
RTInputStream class (ex.), 234-237
RTOutputStream class (ex.), 234-237
RTP (Real-Time Protocol), 230
run( ), 20-21, 84
Runnable interface, 21, 84-85
for asynchronous message passing, 142-143
implementing, 85-91
RunnableSolver class (ex.), 85-88
RunnableSolverClient class (ex.), 90-91
RunnableSolveServer class (ex.), 88-90
runtime environment
Java RMI Registry, 72
loading class definitions, 38-44
object serialization versus, 75
managing threads, 92-94
remote objects and, 52
security and, 18
Runtime interface, 27
S
SchedDbaseImpl class (ex.), 220-224
SchedResource class (ex.), 201-204
data caching and, 210-211
message-passing version, 213-214
RMI-enabled version, 217-220
SchedResourceImpl class (ex.), 218-220
SchedTask class (ex.), 201, 204-206
scheduling system (ex.), 197-225
data caching, 210-212
with JDBC-enabled data objects, 200-210
secret keys, 114
SecretKey class, 117
Secure Socket Layer (SSL), 136
SecureAgent client (ex.), 128-131
SecureRandom class, 116
security, 6, 18-20, 104-106
authentication (see authentication)
security (continued)
certification (see certification)
development object systems and, 55
encryption (see encryption)
general protocols for, 136-137
Java API for (see Java Security API)
keys (see keys)
RMI security manager, 74
Security Service (CORBA), 326-328
send( )
Collaborator interface, 270
Mediator interface, 270
MulticastSocket class, 26
RMICollaboratorImpl class (ex.), 287
sendCommands( ), 13
sendEvent( ), 178
sendMsg( ), 267
serialization, 47, 74-75
JavaSpace interface and, 332-333
Serializable interface, 18, 74
servers
BankServer interface (ex.), 59-60
ChessServer class (ex.), 145, 151-152
implementation of object classes, 51
java.rmi.server package, 344-354
object skeleton, 51
IDL interface and, 60-61, 65-69
Java RMI and, 73
PipedServer class (ex.), 33-34
registration/naming service, 51, 54-55
CORBA and, 61, 70
remote database data servers, 212-225
RemoteServer class, 72, 348-349
RMI implementation, 71
RunnableSolveServer class (ex.), 88-90
ServerCloneException, 350
ServerError, 341
ServerException, 341
ServerNotActiveException, 351
ServerRef interface, 351
ServerRuntimeException, 341
ServerSocket class, 24
SimpleServer class (ex.), 15-17
setAutoCommit( ), 193
setDefaultStream( ), 346
setFailureHandler( ), 350
setLog( ), 348
setOutputStream( ), 346
setPrincipal( ), 112
setRef( ), 349
shared data, collaboration and, 260
shared whiteboard (ex.), 260, 296-309
sharing, systems of (see collaborative systems)
sign( ), 120
signatures
digital, 108, 117-126
DSA (Digital Signature Algorithm), 106-107, 134
public key, 119-121
Signature class, 119-121
SimpleAgent client (ex.), 108-111
certification and, 118-119
SimpleClient class (ex.), 12-15
SimpleCmd class (ex.), 10-11
SimpleCmdInputStream class (ex.), 11-12
SimpleServer class (ex.), 15-17
skeleton, server, 51
IDL interface and, 60-61
Solver interface (ex.), 65-69
Java RMI and, 73
Skeleton class, 351-352
SkeletonMismatchException, 352
SkeletonNotFoundException, 352
sockets, 24-26
DatagramSocket class, 24-26
multicast, 26-27
Socket class, 24-25
SocketSecurityException, 352
Solver interface (ex.), 56-57
in CORBA environment, 62-71
Runnable interface with, 85-91
using Java RMI, 75-81
sophistication of cryptographic algorithms, 132
source code, obtaining, xiii
speed (see performance)
SQL (see databases)
SSL (Secure Socket Layer), 136
standards for distributed computing, x
start( ), 93
state information, sharing, 260
Statement class, 190, 192-193
StreamClassLoader class (ex.), 39-44
streaming audio example, 244-251
streams, 27-35
StringBufferInputStream class, 31
StringReader class, 31
StringWriter class, 31
stub, client, 51
IDL interface and, 61
Solver base interface (ex.), 63-65
Java RMI and, 73
to remote data objects, 215-216
StubNotFoundException, 342
sun.security.acl package, 112
SupplierAdmin interface, 324
suppliers, event, 321-323
SurrogateActionListener interface (ex.), 181-183
suspend( ), 99
symmetric encryption techniques, 127
synchronization of threads, 92, 101-102
synchronized statement, 92
synchronous message handling, 141
system performance (see performance)
T
take( ), 334-335
TCP (Transport Control Protocol), 24
threads, 3, 84-102
asynchronous agents, 94-95
creating, 85-92
distributed ThreadGroups, 95-99
groups of, 93, 95-99
I/O between, 30-35
Java's multithreading support, 20-21
managing, 92-94
multithreading requirements, 5-6
networked, 94-102
priorities for, 93-94, 100-101
synchronizing, 92, 101-102
ThreadGroup class, 93
distributed ThreadGroups, 95-99
Thread class, 20, 84-85
extending (ex.), 91-92
ThreadedWhiteboardUser class (ex.), 305-308
ThreadSolver class (ex.), 91-92
throughput monitoring
raw data, 234-237
real data, 237-243
Throwable interface, 9
TimeConstraint class (ex.), 201, 206-209
tokens, 142
toString( )
LogStream class, 346
ObjID class, 346
Operation class, 347
RemoteObject class, 347
UID class, 353
Transaction class (JavaSpaces), 333
transaction service (CORBA), 328
TransactionConflictException, 334
transactions, JavaSpace, 330-331
transactions, remote, 18-20
transceivers, event, 173-178
Transport Control Protocol (TCP), 24
try/catch/finally statements, 8
two-way agent authentication, 133
U
UDP (Unreliable Datagram Protocol), 24-26
UID class, 353
unbind( )
Naming interface, 338
Remote interface, 344
UnexpectedException, 342
UnicastRemoteObject class, 72, 353
Uniform Resource Locators (see URLs)
UnknownHostException, 342
UnmarshalException, 342-343
unreferenced( ), 353
Unreferenced interface, 353-354
Unreliable Datagram Protocol (UDP), 24-26
UnusableEntryException, 333
update( ), 119-120
updateFromDbase( ), 201, 204, 226
updateToDbase( ), 201, 226
URLs (Uniform Resource Locators), 35-38
loading classes from (ex.), 41-44
URL class, 35-37
URLClassLoader class (ex.), 41-44
URLConnection class, 35-38
user API (java.security), 106-107
user authentication (see authentication)
V
verify( ), 121
verifying
agent identity, 105, 125-126
digital signatures, 120
incoming objects, 105
visiting agents, 105
W
web browser example, 251-256
whiteboard example, 311-317
mouse events and, 300-305
shared, 260, 296-309
WhiteboardApplet class (ex.), 315-316
WhiteboardMediator class (ex.), 308-309
WhiteboardUser class (ex.), 297-305
workload distribution, 51
write( )
JavaSpace interface, 334
LogStream class, 346
ObjID class, 346
UID class, 353
writeArgs( ), 157-160
Writer classes, 27-35
X
X.509 standard certificate format, 135
XDR-formatted data I/O (ex.), 29-30
Z
Zimmermann, Phil, 136
Preface
This book is a desktop quick reference for programmers working with Internet electronic mail. It also serves as a tutorial for those interested in learning more about the internal workings of the Internet mail system. It was written primarily because I needed it. I could not find adequate information elsewhere on Internet e-mail is a reasonably compact form.
Until this publication, one had to read rather academic-sounding Internet Requests for Comments in order to learn about e-mail on the 'Net. Hopefully, it will allow people to learn about the Internet mail system without having to learn the Augmented Backus-Naur Form meta-language common in the standards. We've also included some pretty pictures ;A)
Within these pages are e-mail formats, protocols, APIs and examples. While not exactly ships and shoes and sealing wax, they should be enough to teach novices and provide a handy reference to daily coders. The formats show how e-mail messages and mailboxes are formatted in text. The protocols illustrate how e-mail servicescommunicate to pass messages and the APIs provide code libraries in Perl and Java so that you won't have to reinvent the wheel. The examples attempt to show how to work with e-mail to enhance your daily life or expand the capabilities of a program.