Tuesday, November 29, 2011

An Introduction to Network Programming with Java






Contents
Chapter 1 Basic Concepts, Protocols and Terminology ......................... 1
1.1 Clients, Servers and Peers ................................................................. 1
1.2 Ports and Sockets .............................................................................. 2
1.3 The Internet and IP Addresses .......................................................... 3
1.4 Internet Services, URLs and DNS .................................................... 4
1.5 TCP ................................................................................................... 5
1.6 UDP .................................................................................................. 7
Chapter 2 Starting Network Programming in Java ............................... 9
2.1 The InetAddress Class ...................................................................... 9
2.2 Using Sockets ................................................................................... 12
2.2.1 TCP Sockets ..... .................................................................... 12
2.2.2 Datagram (UDP) Sockets ....................................................... 18
2.3 Network Programming with GUIs ................................................... 28
2.4 Downloading Web Pages ................................................................. 37
Exercises ................................................................................................... 41
Chapter 3 Multithreading and Multiplexing .......................................... 51
3.1 Thread Basics ................................................................................... 51
3.2 Using Threads in Java ..................................................................... 52
3.2.1 Extending the Thread Class ................................................... 53
3.2.2 Explicitly Implementing the Runnable Interface ...................... 57
3.3 Multithreaded Servers ..................................................................... 60
3.4 Locks and Deadlock ........................................................................ 65
3.5 Synchronising Threads .................................................................... 67
3.6 Non-Blocking Servers ..................................................................... 74
3.6.1 Overview ................................................................................. 74
3.6.2 Implementation ......................................................................... 76
3.6.3 Further Details .......................................................................... 86
Exercises .................................................................................................. 88
Chapter 4 File Handling .......................................................................... 91
4.1 Serial Access Files .......................................................................... 91
4.2 File Methods ................................................................................... 97
4.3 Redirection .................................................................................... 99
4.4 Command Line Parameters ............................................................ 101
4.5 Random Access Files ..................................................................... 102
4.6 Serialisation .................................................................................... 109
4.7 File I/O with GUIs ......................................................................... 113
4.8 Vectors ........................................................................................... 120
4.9 Vectors and Serialisation ............................................................... 123
Exercises ................................................................................................. 132
Chapter 5 Remote Method Invocation (RMI) ...................................... 136
5.1 The Basic RMI Process .................................................................. 136
5.2 Implementation Details .................................................................. 137
5.3 Compilation and Execution ............................................................ 141
5.4 Using RMI Meaningfully ............................................................... 143
5.5 RMI Security .................................................................................. 153
Exercises ................................................................................................. 156
Chapter 6 CORBA ................................................................................... 158
6.1 Background and Basics ................................................................... 158
6.2 The Structure of a Java IDL Specification ...................................... 159
6.3 The Java IDL Process ...................................................................... 163
6.4 Using Factory Objects ..................................................................... 173
6.5 Object Persistence ........................................................................... 184
6.6 RMI-IIOP ........................................................................................ 184
Exercises .................................................................................................. 186
Chapter 7 Java Database Connectivity (JDBC) ................................... 188
7.1 The Vendor Variation Problem ....................................................... 188
7.2 SQL and Versions of JDBC ............................................................ 189
7.3 Creating an ODBC Data Source ..................................................... 190
7.4 Simple Database Access .................................................................. 191
7.5 Modifying the Database Contents ................................................... 199
7.6 Transactions .................................................................................... 203
7.7 Meta Data ........................................................................................ 204
7.8 Using a GUI to Access a Database ................................................. 207
7.9 Scrollable ResultSets in JDBC 2.0 .................................................. 210
7.10 Modifying Databases via Java Methods ......................................... 215
7.11 Using the DataSource Interface ...................................................... 220
7.11.1 Overview and Support Software ............................................ 220
7.11.2 Defining a JNDI Resource Reference ....................................... 222
7.11.3 Mapping the Resource Reference onto a Real Resource ........... 223
7.11.4 Obtaining the Data Source Connection ..................................... 225
7.11.5 Data Access Objects .................................................................. 226
Exercises .................................................................................................. 232
Chapter 8 Servlets .................................................................................... 234
8.1 Servlet Basics .................................................................................... 234
8.2 Setting up the Servlet API ............................................................... 235
8.3 Creating a Web Application ............................................................ 237
8.4 The Servlet URL and the Invoking Web Page ................................ 239
8.5 Servlet Structure ............................................................................... 240
8.6 Testing a Servlet .............................................................................. 242
8.7 Passing Data .................................................................................... 242
8.8 Sessions ........................................................................................... 249
8.9 Cookies ............................................................................................ 260
8.10 Accessing a Database Via a Servlet ................................................ 268
Exercises .................................................................................................. 275
Chapter 9 JavaServer Pages (JSPs) ........................................................ 278
9.1 The Rationale behind JSPs ............................................................... 278
9.2 Compilation and Execution ............................................................. 279
9.3 JSP Tags .......................................................................................... 280
9.4 Implicit JSP Objects ........................................................................ 283
9.5 Collaborating with Servlets ............................................................. 285
9.6 JSPs in Action ................................................................................. 285
9.7 Error Pages ...................................................................................... 291
9.8 Using JSPs to Access Remote Databases ....................................... 294
Exercises .................................................................................................. 295
Chapter 10 JavaBeans ................................................................................ 297
10.1 Introduction to the Bean Builder .................................................... 298
10.2 Creating a JavaBean ....................................................................... 301
10.3 Exposing a Bean's Properties ......................................................... 307
10.4 Making Beans Respond to Events ................................................. 311
10.5 Using JavaBeans within an Application ........................................ 315
10.6 Bound Properties ........................................................................... 317
10.7 Using JavaBeans in JSPs ............................................................... 324
10.7.1 The Basic Procedure ........................................................ 324
10.7.2 Calling a Bean's Methods Directly .................................. 326
10.7.3 Using HTML Tags to Manipulate a Bean's Properties .... 330
Exercises .................................................................................................. 342
Chapter 11 Introduction to Enterprise JavaBeans ................................. 345
11.1 Categories of EJB ........................................................................... 345
11.2 Basic Structure of an EJB ............................................................... 346
11.3 Packaging and Deployment ............................................................ 349
11.4 Client Programs .............................................................................. 351
11.5 Entity EJBs ..................................................................................... 353
Chapter 12 Multimedia ............................................................................. 359
12.1 Transferring and Displaying Images Easily ................................... 360
12.2 Transferring Media Files ................................................................ 365
12.3 Playing Sound Files ....................................................................... 370
12.4 The Java Media Framework ........................................................... 372
Exercises ................................................................................................. 379
Chapter 13 Applets ................................................................................... 380
13.1 Applets and JApplets ...................................................................... 380
13.2 Applet Basics and the Development Process ................................. 381
13.3 The Internal Operation of Applets .................................................. 385
13.4 Using Images in Applets ................................................................ 392
13.4.1 Using Class Image ........................................................... 392
13.4.2 Using Class ImageIcon .................................................... 397
13.5 Scaling Images ................................................................................ 400
13.6 Using Sound in Applets .................................................................. 401
Exercises .................................................................................................. 405
Appendix A Structured Query Language (SQL) ............................. 406
Appendix B Deployment Descriptors for EJBs ................................ 411
Appendix C Further Reading ............................................................. 414
Index ............................................................................................................. 417

Another Java Books

Another Network Books
Download

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!