Programming $49.99 USA/$74.99 CAN/£39.99 UK INCLUDES CD-ROM In this unique guide, a crack team of software engineers delivers the programming solutions and source code you need to jump start a Java- or C#based instant messaging project using the Jabber protocol With flow charts and line-by-line analysis of a professional-quality instant messaging system, they show you how to solve typical IM programming challenges — and create your own Jabber application using Java or C#, Web services, XML, ADO.NET, J2ME, and other cutting-edge technologies Take an In-Depth Look at ProfessionalGrade Instant Messaging Applications • Java instant messaging server module • C# instant messaging server module • Java instant messaging client module DREAMTECH SOFTWARE INDIA, INC., is a leading provider of corporate software solutions Based in New Delhi, India, the Dreamtech software team has more than 50 years of combined software engineering experience • C# instant messaging client module • J2ME mobile client extension • Integrate instant messaging applications with web services • More than 14,000 lines of documented code The CD-ROM features: • Jabber-compatible instant messaging system, in both Java and C# versions, with a J2ME mobile extension • Java Software Development Kit Standard Edition, version 1.4 for Windows • Java Platform, Micro Edition, Wireless Toolkit 1.0.3 • Forte for Java, release 3.0, Community Edition • Tomcat • Xerces • kXML Note: All software tested at the Dreamtech Software Research Lab Wiley Computer Publishing Instant Messaging Systems Create Tomorrow’s Instant Messaging Applications Today Instant Messaging Systems Complete source code and design to create your own IM applications Timely Practical Reliable Visit our Web site at www.wiley.com/compbooks/ Dreamtech Software Team ISBN: 0-7645-4953-7 *85 -B ABFb ,!7IA7G4-fejfd !:p;o;t;T;T Dreamtech Software Team Instant Messaging Systems Cracking the Code™ Dreamtech Software Team Wiley Publishing, Inc Best-Selling Books • Digital Downloads • e-Books • Answer Networks • e-Newsletters • Branded Web Sites • e-Learning Instant Messaging Systems: Cracking the Code™ Published by Wiley Publishing, Inc 605 Third Avenue New York, NY 10158 www.wiley.com This book is printed on acid-free paper Copyright © 2002 by Wiley Publishing, Inc All rights reserved Published by Wiley Publishing, Inc No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744 Requests to the Publisher for permission should be addressed to the Permissions Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, Fax: (317) 572-4447, E-Mail: permcoordinator@wiley.com.This publication is designed to provide accurate and authoritative information in regard to the subject matter covered It is sold with the understanding that the publisher is not engaged in professional services If professional advice or other expert assistance is required, the services of a competent professional person should be sought Wiley, the Wiley Publishing logo, and Cracking the Code are trademarks or registered trademarks of Wiley Publishing, Inc., in the United States and other countries, and may not be used without written permission All other trademarks are the property of their respective owners Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book Library of Congress Control Number: 2002106774 ISBN: 0-7645-4953-7 Printed in the United States of America 10 1B/QW/QU/QS/IN Dreamtech Software India Inc., Team dreamtech@mantraonline.com www.dreamtechsoftware.com Dreamtech Software India Inc is a leading provider of corporate software solutions Based in New Delhi, India, the company is a successful pioneer of innovative solutions in e-learning technologies Dreamtech’s developers have more than 50 years of combined softwareengineering experience in areas such as Java; Wireless Applications, XML, Voice-based solutions, NET, COM/COM++ technologies, Distributed Computing, DirectX, Windows Media technologies, and security solutions About the Authors Vikas Gupta is co-founder and president of Dreamtech Software He is engaged in developing and designing new technologies in wireless applications, e-learning, and other cutting-edge areas He is also the Managing Director of Wiley Dreamtech India (P) Ltd Avnish Dass, co-founder and CEO of Dreamtech Software, is a talented and seasoned programmer who has 15 years of experience in systems and application/database programming He has developed security systems, antivirus programs, wireless and communication technologies, and ERP systems Gaurav Malhotra is a software developer at Dreamtech and has advanced-level programming experience in C, C++, and Java Pratul Katyal is a senior software developer at Dreamtech He has two years of experience in developing software in C, C++, C#, Visual Basic, and NET technologies Credits Executive Editor Chris Webb Project Editors Neil Romanosky Kevin Kent Vice President and Executive Publisher Bob Ipsen Vice President and Publisher Joseph B Wikert Technical Editor N R Parsa Executive Editorial Director Mary Bednarek Copy Editors C M Jones Bill Barton Project Coordinator Dale White Editorial Manager Mary Beth Wakefield Vice President and Executive Group Publisher Richard Swadley Proofreading Anne Owen Indexing Johnna VanHoose Dinse To our parents and family and our beloved country, India, for providing an excellent environment for creating and nurturing world-class IT talent Preface Ever since its emergence in the early 1990s, the Internet has radically changed the way of accessing and exchanging information among desktops around the globe Today, almost every information-hungry business banks heavily upon the Internet The success of business in the 21st century depends not only on procuring up-to-date information but also on procuring it fast It is in consideration of such a scenario that we have developed the Instant Messaging application described in this book Throughout the book, the application is developed in both C# and Java, the two most popular programming languages at this time Because the Instant Messaging application is extensible to both of these languages, it is able to meet the exacting demands of today’s e-business environment What this Book Covers This book details the technology for integrating an Instant Messaging application with the Jabber server It is quite evident that there is jetlag among the Instant Messaging applications available on the market, especially when it comes to communicating with one other This book is the first attempt in developing an application that can be integrated with the Jabber server to tide-over the barriers of cross-platform communication The source code provided in the CD that accompanies this book has been developed with the prime emphasis on the requirements of the business world The book has been written with focus on code, and every effort has been made to keep theory to a minimum The source code provided in the accompanying CD is fully tested at the Dreamtech Software Research Lab, India, and is fully operational This book gives you complete insight into the design and implementation aspects of the application The book begins with an introductory note on Instant Messaging and goes on to explain how Jabber clients can be built with scope for extension to meet the challenges that are likely to come up because of the rapid change in technology and increasing customer demands Who Should Read this Book The book addresses programmers and developers of the intermediate to advanced level It is meant for IT professionals who are keen to learn this specific technology The book primarily targets innovative software designers and programmers and inspires them to impart new dimensions to the Instant Messaging application presented IT personnel interested in exploring the open-source based Instant Messaging model, Jabber, will find this book informative Since the application is built using the Java and C# programming languages, programmers using these two languages are offered an opportunity to sharpen their skills An additional advantage offered by the add-on feature of this Instant Messaging application is that, because the application is built using J2ME, readers across the globe stand to reap the benefits Readers are expected to have a firm grip over technologies such as C# and Java While developing the application, the fast emerging concept of Web services has also been viii Preface considered Thus, to understand the book fully, it is mandatory for the reader to have substantial knowledge of ADO.NET and RDBMS such as SQL or Sybase Since the application closely works with the Jabber server and the communication standard of the application is XML, which has been employed to neutralize the differences arising from the variety of platforms, thorough knowledge of the XML structure as supported by Jabber is essential The code for the application is supplemented with exhaustive explanations How this Book Is Organized Chapter provides a description of the concept and scope of the Instant Messaging application and outlines its evolution to the most modern form While discussing the concept of an Instant Messaging application, the latest form of the open-source, Instant Messaging Model (Jabber) is taken up Since the communication standard of the Jabber server is XML based, the structure of XML as supported by the Jabber server for communication is provided in this chapter Chapter details the designing process of the application and provides a comprehensive picture of the Instant Messaging application we intend to develop across the book This chapter begins with a briefing regarding the prerequisites for developing the application After this, the database design of the application is provided When database is discussed, it must be noted that this application uses SQL Server 2000 for maintaining the database The reader is therefore required to possess some skill in writing SQL queries and to establish the connection between the front and back ends of the application The two modules of the application, the server and client, are detailed in this chapter, along with design considerations The communication that takes place between the server and the client is also discussed in this chapter Since our application is integrating with the jabber server, various issues involved in creating and closing the session with the Jabber server are outlined in this chapter Since this chapter involves the core designing of the application, readers such as application designers can benefit from this chapter by developing their own application based on the approach assumed in developing this application Chapter introduces the basic principles of the Java version of the server module of this Instant Messaging application The chapter begins with an introductory note on the Web service and the methodology involved in building and accessing the Web service The development phase of the server module is also discussed in this chapter Since our application works closely with the Jabber Instant Messaging model, the communication norms between the server module and the Jabber server have been clarified Further, the role of the server in parsing and processing various client requests and the way the server interprets the messages flowing from the Jabber side have been detailed in this chapter As mentioned earlier, since Web services are brought up in this chapter, the various Web methods deployed in our application are also discussed in this chapter Apart from detailing the entire server module of Preface ix the application, the use of IBM Xerces XML parser and the principle of server programmingsocket and multithreading have been explained in this chapter Chapter covers the C# version of the server module of the application The chapter begins by laying down the requirements for developing the server Various Web services used by the server module are discussed in this chapter, along with the techniques involved in creating and accessing the Web service Since the Web service involved in our application handles the task of retrieving data from the database, the reader must have sufficient knowledge of ADO.NET and SQL Server 2000 Some familiarity with socket and thread programming is also needed Those who possess network-programming skills stand to gain an edge over those who not Since the server module communicates with the Jabber server on one hand and with the client module on the other, the communication of the server module with the Jabber server and the client module is presented in this chapter Also, responses of various Web methods handled by the server module have been addressed this chapter Toward the end of this chapter, the working of the various Web methods involved in our application have been discussed briefly The Java version of the client module for the Instant Messaging application is discussed in Chapter The chapter begins with an introduction to client programming, which presents guidelines for developing the client module for the application It is appropriate to mention here that the reader must have sufficient knowledge of Swing class, as it is used extensively while creating the GUI for the client module Later, how the client module establishes the connection with the server and delivers various kinds of requests is explained in this chapter The responses generated by the server module against the request made by the client module have also been separately presented in this chapter The reader must be familiar with the concept of the socket and thread classes and the working and usage of the IBM Xerces parser for establishing the connection with the server Chapter of this book covers the C# version of the client module for the Instant Messaging application To appreciate this chapter fully, the reader must be equipped with a sound knowledge of socket and thread classes This chapter begins with an introduction to client programming, which apprises the reader about the scope of client programming Following this, the server module is explained To realize the technique involved behind establishing the connection with the local server, the reader must be familiar with thread and socket classes Since the client module is the origin of all requests, the various types of requests delivered by the client module and the processes involved in delivering the requests are presented in this chapter The parsing of various server responses is carried out by the in-built parsing facility provided by the XML Document class present in the C# environment In Chapter 7, the add-on feature of the application is detailed The Instant Messaging application is enhanced to bring handheld devices within its range The client module of the Instant Messaging application is adapted to suit handheld devices To program and understand the working involved in the background, the reader must be thorough with programming methodology that uses J2ME Since J2ME programming is specially meant for handheld devices, programming for J2ME is outlined in this chapter, along with details of the relevant 10 interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement LIMITED WARRANTY Sun warrants to you that for a period of ninety (90) days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use Except for the foregoing, Software is provided "AS IS" Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software DISCLAIMER OF WARRANTY UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID LIMITATION OF LIABILITY TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement The foregoing limitations will apply even if the above stated warranty fails of its essential purpose Termination This Agreement is effective until terminated You may terminate this Agreement at any time by destroying all copies of Software This Agreement will terminate immediately without notice from Sun if you fail to comply with any provision of this Agreement Upon Termination, you must destroy all copies of Software Export Regulations All Software and technical data delivered under this Agreement are subject to US export control laws and may be subject to export or import regulations in other countries You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain such licenses to export, re-export, or import as may be required after delivery to you U.S Government Restricted Rights If Software is being acquired by or on behalf of the U.S Government or by a U.S Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions) Governing Law Any action related to this Agreement will be governed by California law and controlling U.S federal law No choice of law rules of any jurisdiction will apply Severability If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate 11 Integration This Agreement is the entire agreement between you and Sun relating to its subject matter It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party JAVA™ DEVELOPMENT TOOLS J2ME™ WIRELESS TOOLKIT (J2ME WTK), VERSION 1.0.x SUPPLEMENTAL LICENSE TERMS These supplemental license terms ("Supplemental Terms") add to or modify the terms of the Binary Code License Agreement (collectively, the "Agreement") Capitalized terms not defined in these Supplemental Terms shall have the same meanings ascribed to them in the Agreement These Supplemental Terms shall supersede any inconsistent or conflicting terms in the Agreement, or in any license contained within the Software Software Internal Use and Development License Grant Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java(TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce internally and use internally the binary form of the Software complete and unmodified for the sole purpose of designing, developing and testing your Java applets and applications intended to run on the Java platform ("Programs") provided that any executable output generated by a compiler that is contained in the Software must (a) only be compiled from source code that conforms to the corresponding version of the OEM Java Language Specification; (b) be in the class file format defined by the corresponding version of the OEM Java Virtual Machine Specification; and (c) execute properly on a reference runtime, as specified by Sun, associated with such version of the Java platform Java Technology Restrictions You may not modify the Java Platform Interface ("JPI", identified as classes contained within the "java" package or any subpackages of the "java" package), by creating additional classes within the JPI or otherwise causing the addition to or modification of the classes in the JPI In the event that you create an additional class and associated API(s) which (i) extends the functionality of the Java platform, and (ii) is exposed to third party software developers for the purpose of developing additional software which invokes such additional API, you must promptly publish broadly an accurate specification for such API for free use by all developers You may not create, or authorize your licensees to create, additional classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation Java Runtime Availability Refer to the appropriate version of the Java Runtime Environment binary code license (currently located at http://www.java.sun.com/jdk/index.html) for the availability of runtime code which may be distributed with Java applets and applications Trademarks and Logos You acknowledge and agree as between you and Sun that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET-related trademarks, service marks, logos and other brand designations ("Sun Marks"), and you agree to comply with the Sun Trademark and Logo Usage Requirements currently located at http://www.sun.com/policies/trademarks Any use you make of the Sun Marks inures to Sun's benefit Source Code Software may contain source code that is provided solely for reference purposes pursuant to the terms of this Agreement Source code may not be redistributed unless expressly provided for in this Agreement Termination for Infringement Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right For inquiries please contact: Sun Microsystems, Inc 901 San Antonio Road, Palo Alto, California 94303 (LFI#101620/Form ID#011801) Forte for Java, release 3.0, Enterprise Edition Try and Buy, Multi-Language To obtain Forte for Java, release 3.0, Enterprise Edition Try and Buy, Multi-Language, you must agree to the software license below Sun Microsystems Inc Try and Buy Binary Software License Agreement SUN IS WILLING TO LICENSE THE ACCOMPANYING BINARY SOFTWARE IN MACHINE- READABLE FORM, TOGETHER WITH ACCOMPANYING DOCUMENTATION (COLLECTIVELY "SOFTWARE") TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS AND CONDITION CONTAINED IN THIS TRY AND BUY LICENSE AGREEMENT READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF THIS AGREEMENT LICENSE TO EVALUATE (TRY) THE SOFTWARE: If you have not paid the applicable license fees for the Software, the Binary Code License Agreement ("BCL") and the Evaluation Terms ("Evaluation Terms") below shall apply The BCL and the Evaluation Terms shall collectively be referred to as the Evaluation Agreement ("Evaluation Agreement") LICENSE TO USE (BUY) THE SOFTWARE: If you have paid the applicable license fees for the Software, the BCL and the Supplemental Terms ("Supplemental Terms") provided following the BCL shall apply The BCL and the Supplemental Terms shall collectively be referred to as the Agreement ("Agreement") EVALUATION TERMS If you have not paid the applicable license fees for the Software, the terms of the Evaluation Agreement shall apply These Evaluation Terms add to or modify the terms of the BCL Capitalized terms not defined in these Evaluation Terms shall inconsistent or conflicting terms in the BCL below, or in any license contained within the Software LICENSE TO EVALUATE Sun grants to you, a non-exclusive, non-transferable, royalty-free and limited license to use the Software internally for the purposes of evaluation only for sixty (60) days after the date you install the Software on your system ("Evaluation Period") No license is granted to you for any other purpose You may not sell, rent, loan or otherwise encumber or transfer the Software in whole or in part, to any third party Licensee shall have no right to use the Software for productive or commercial use TIMEBOMB Software may contain a timebomb mechanism You agree to hold Sun harmless from any claims based on your use of Software for any purposes other than those of internal evaluation TERMINATION AND/OR EXPIRATION Upon expiration of the Evaluation Period, unless terminated earlier by Sun, you agree to immediately cease use of and destroy Software NO SUPPORT Sun is under no obligation to support Software or to provide upgrades or error corrections ("Software Updates") to the Software If Sun, at its sole option, supplies Software Updates to you, the Software Updates will be considered part of Software, and subject to the terms NO SUPPLEMENTAL TERMS The Supplemental Terms following the BCL not apply to the Evaluation Agreement Sun Microsystems, Inc Binary Code License Agreement READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF THIS AGREEMENT LICENSE TO USE Sun grants you a non-exclusive and non-transferable license for the internal use only of the accompanying software and documentation and any error corrections provided by Sun (collectively "Software"), by the number of users and the class of computer hardware for which the corresponding fee has been paid RESTRICTIONS Software is confidential and copyrighted Title to Software and all associated intellectual property rights is retained by Sun and/or its licensors Except as specifically authorized in any Supplemental License Terms, you may not make copies of Software, other than a single copy of Software for archival purposes Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software You acknowledge that Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility Sun disclaims any express or implied warranty of fitness for such uses No right, title or interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement LIMITED WARRANTY Sun warrants to you that for a period of ninety (90) days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use Except for the foregoing, Software is provided "AS IS" Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software DISCLAIMER OF WARRANTY UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID .LIMITATION OF LIABILITY TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement The foregoing limitations will apply even if the above stated warranty fails of its essential purpose Termination This Agreement is effective until terminated You may terminate this Agreement at any time by destroying all copies of Software This Agreement will 10 11 terminate immediately without notice from Sun if you fail to comply with any provision of this Agreement Upon Termination, you must destroy all copies of Software Export Regulations All Software and technical data delivered under this Agreement are subject to US export control laws and may be subject to export or import regulations in other countries You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain such licenses to export, re-export, or import as may be required after U.S Government Restricted Rights If Software is being acquired by or on behalf of the U.S Government or by a U.S Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions) Governing Law Any action related to this Agreement will be governed by California law and controlling U.S federal law No choice of law rules of any jurisdiction will apply Severability If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate Integration This Agreement is the entire agreement between you and Sun relating to its subject matter It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party FORTE™ FOR JAVA™, RELEASE 3.0, ENTERPRISE EDITION SUPPLEMENTAL LICENSE TERMS These supplemental license terms ("Supplemental Terms") add to or modify the terms of the Binary Code License Agreement (collectively, the "Agreement") Capitalized terms not defined in these Supplemental Terms shall have the same meanings ascribed to them in the Agreement These Supplemental Terms shall supersede any inconsistent or conflicting terms in the Agreement, or in any license contained within the Software Software Internal Use and Development License Grant Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java(TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to use internally the binary form of the Software complete and unmodified for the sole purpose of designing, developing and testing your Java applets and applications intended to run on the Java platform License to Distribute Redistributables Subject to the terms and conditions of this Agreement, including but not limited to Section (Java Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce and distribute the binary form of those files specifically identified as redistributable in the Software "RELEASE NOTES" file ("Redistributables") provided that: (i) you distribute the Redistributables complete and unmodified (unless otherwise specified in the applicable RELEASE NOTES file), and only bundled as part of Programs, (ii) you not distribute additional software intended to supersede any component(s) of the Redistributables, (iii) you not remove or alter any proprietary legends or notices contained in or on the Redistributables, (iv) for a particular version of the Java platform, any executable output generated by a compiler that is contained in the Software must (a) only be compiled from source code that conforms to the corresponding version of the OEM Java Language Specification; (b) be in the class file format defined by the corresponding version of the OEM Java Virtual Machine Specification; and (c) execute properly on a reference runtime, as specified by Sun, associated with such version of the Java platform, (v) you only distribute the Redistributables pursuant to a license agreement that protects Sun's interests consistent with the terms contained in the Agreement, and (v) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software Java Technology Restrictions You may not modify the Java Platform Interface ("JPI", identified as classes contained within the "java" package or any subpackages of the "java" package), by creating additional classes within the JPI or otherwise causing the addition to or modification of the classes in the JPI In the event that you create an additional class and associated API(s) which (i) extends the functionality of the Java platform, and (ii) is exposed to third party software developers for the purpose of developing additional software which invokes such additional API, you must promptly publish broadly an accurate specification for such API for free use by all developers You may not create, or authorize your licensees to create, additional classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any Java Runtime Availability Refer to the appropriate version of the Java Runtime Environment binary code license (currently located at http://www.java.sun.com/jdk/index.html) for the availability of runtime code which may be distributed with Java applets and applications 5 Trademarks and Logos You acknowledge and agree as between you and Sun that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET-related trademarks, service marks, logos and other brand designations ("Sun Marks"), and you agree to comply with the Sun Trademark and Logo Usage Requirements currently located at http://www.sun.com/policies/trademarks Any use you make of the Sun Marks inures to Sun's benefit Source Code Software may contain source code that is provided solely for reference purposes pursuant to the terms of this Agreement Source code may not be redistributed unless expressly provided for in this Agreement Termination for Infringement Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right For inquiries please contact: Sun Microsystems, Inc 901 San Antonio Road, Palo Alto, California 94303 (LFI#91206/Form ID#011801) Forte for Java, release 3.0, Community Edition, English To obtain Forte for Java, release 3.0, Community Edition, English, you must agree to the software license below Sun Microsystems, Inc Binary Code License Agreement READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF THIS AGREEMENT LICENSE TO USE Sun grants you a non-exclusive and non-transferable license for the internal use only of the accompanying software and documentation and any error corrections provided by Sun (collectively "Software"), by the number of users and the class of computer hardware for which the corresponding fee has been paid RESTRICTIONS Software is confidential and copyrighted Title to Software and all associated intellectual property rights is retained by Sun and/or its licensors Except as specifically authorized in any Supplemental License Terms, you may not make copies of Software, other than a single copy of Software for archival purposes Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software You acknowledge that Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility Sun disclaims any express or implied warranty of fitness for such uses No right, title or interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement LIMITED WARRANTY Sun warrants to you that for a period of ninety (90) days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use Except for the foregoing, Software is provided "AS IS" Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software DISCLAIMER OF WARRANTY UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID 5 LIMITATION OF LIABILITY TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement The foregoing limitations will apply even if the above stated warranty fails of its essential purpose Termination This Agreement is effective until terminated You may terminate this Agreement at any time by destroying all copies of Software This Agreement will terminate immediately without notice from Sun if you fail to comply with any provision of this Agreement Upon Termination, you must destroy all copies of Software Export Regulations All Software and technical data delivered under this Agreement are subject to US export control laws and may be subject to export or import regulations in other countries You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain such licenses to export, re-export, or import as may be required after delivery to you U.S Government Restricted Rights If Software is being acquired by or on behalf of the U.S Government or by a U.S Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions) Governing Law Any action related to this Agreement will be governed by California law and controlling U.S federal law No choice of law rules of any jurisdiction will apply 10 Severability If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate 11 Integration This Agreement is the entire agreement between you and Sun relating to its subject matter It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party FORTE™ FOR JAVA™, RELEASE 3.0, COMMUNITY EDITION SUPPLEMENTAL LICENSE TERMS These supplemental license terms ("Supplemental Terms") add to or modify the terms of the Binary Code License Agreement (collectively, the "Agreement") Capitalized terms not defined in these Supplemental Terms shall have the same meanings ascribed to them in the Agreement These Supplement contained within the Software 1 Software Internal Use and Development License Grant Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java(TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce internally and use internally the binary form of the Software complete and unmodified for License to Distribute Software Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java (TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce and distribute the Software in binary code form only, provided that (i) you distribute the Software complete and unmodified and only bundled as part of, and for the sole purpose of running, your Programs, (ii) the Programs add significant and primary functionality to the Software, (iii) you not distribute additional software intended to replace any component(s) of the Software, (iv) for a particular version of the Java platform, any executable output generated by a compiler that is contained in the Software must (a) only be compiled from source code that conforms to the corresponding version of the OEM Java Language Specification; (b) be in the class file format defined by the corresponding version of the OEM Java Virtual Machine Specification; and (c) execute properly on a reference runtime, as specified by Sun, associated with such version of the Java platform, (v) you not remove or alter any proprietary legends or notices contained in the Software, (v) you only distribute the Software subject to a license agreement that protects Sun's interests consistent with the terms contained in this Agreement, and (vi) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or License to Distribute Redistributables Subject to the terms and conditions of this Agreement, including but not limited to Section (Java Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce and distribute the binary form of those files specifically identified as redistributable in the Software "RELEASE NOTES" file ("Redistributables") provided that: (i) you distribute the Redistributables complete and unmodified (unless otherwise specified in the applicable RELEASE NOTES file), and only bundled as part of Programs, (ii) you not distribute additional software intended to supersede any component(s) of the Redistributables, (iii) you not remove or alter any proprietary legends or notices contained in or on the Redistributables, (iv) for a particular version of the Java platform, any executable output generated by a compiler that is contained in the Software must (a) only be compiled from source code that conforms to the corresponding version of the OEM Java Language Specification; (b) be in the class file format defined by the corresponding version of the OEM Java Virtual Machine Specification; and (c) execute properly on a reference runtime, as specified by Sun, associated with such version of the Java platform, (v) you only distribute the Redistributables pursuant to a license agreement that protects Sun's interests consistent with the terms contained in the Agreement, and (v) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software Java Technology Restrictions You may not modify the Java Platform Interface ("JPI", identified as classes contained within the "java" package or any subpackages of the "java" package), by creating additional classes within the JPI or otherwise causing the addition to or modification of the classes in the JPI In the event that you create an additional class and associated API(s) which (i) extends the functionality of the Java platform, and (ii) is exposed to third party software developers for the purpose of developing additional software which invokes such additional API, you must promptly publish broadly an accurate specification for such API for free use by all developers You may not create, or authorize your licensees to create, additional classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation Java Runtime Availability Refer to the appropriate version of the Java Runtime Environment binary code license (currently located at http://www.java.sun.com/jdk/index.html) for the availability of runtime code which may be distributed with Java applets and applications Trademarks and Logos You acknowledge and agree as between you and Sun that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET-related trademarks, service marks, logos and other brand designations ("Sun Marks"), and you agree to comply with the Sun Trademark and Logo Usage Requirements currently located at http://www.sun.com/policies/trademarks Any use you make of the Sun Marks inures to Sun's benefit Source Code Software may contain source code that is provided solely for reference purposes pursuant to the terms of this Agreement Source code may not be redistributed unless expressly provided for in this Agreement Termination for Infringement Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right For inquiries please contact: Sun Microsystems, Inc 901 San Antonio Road, Palo Alto, California 94303 (LFI#91205/Form ID#011801) Wiley Publishing, Inc End-User License Agreement READ THIS You should carefully read these terms and conditions before opening the software packet(s) included with this book "Book" This is a license agreement "Agreement" between you and Wiley Publishing, Inc."WPI" By opening the accompanying software packet(s), you acknowledge that you have read and accept the following terms and conditions If you not agree and not want to be bound by such terms and conditions, promptly return the Book and the unopened software packet(s) to the place you obtained them for a full refund License Grant WPI grants to you (either an individual or entity) a nonexclusive license to use one copy of the enclosed software program(s) (collectively, the "Software" solely for your own personal or non-commercial purposes on a single computer (whether a standard computer or a workstation component of a multi-user network) The Software is in use on a computer when it is loaded into temporary memory (RAM) or installed into permanent memory (hard disk, CD-ROM, or other storage device) WPI reserves all rights not expressly granted herein Ownership WPI is the owner of all right, title, and interest, including copyright, in and to the compilation of the Software recorded on the disk(s) or CD-ROM "Software Media" Copyright to the individual programs recorded on the Software Media is owned by the author or other authorized copyright ownerof each program Ownership of the Software and all proprietary rights relatingthereto remain with WPI and its licensers Restrictions On Use and Transfer (a) You may only (i) make one copy of the Software for backup or archival purposes, or (ii) transfer the Software to a single hard disk, provided that you keep the original for backup or archival purposes You may not (i) rent or lease the Software, (ii) copy or reproduce the Software through a LAN or other network system or through any computer subscriber system or bulletin- board system, or (iii) modify, adapt, or create derivative works based on the Software (b) You may not reverse engineer, decompile, or disassemble the Software You may transfer the Software and user documentation on a permanent basis, provided that the transferee agrees to accept the terms and conditions of this Agreement and you retain no copies If the Software is an update or has been updated, any transfer must include the most recent update and all prior versions Restrictions on Use of Individual Programs You must follow the individual requirements and restrictions detailed for each individual program in the About the CD-ROM appendix of this Book These limitations are also contained in the individual license agreements recorded on the Software Media These limitations may include a requirement that after using the program for a specified period of time, the user must pay a registration fee or discontinue use By opening the Software packet(s), you will be agreeing to abide by the licenses and restrictions for these individual programs that are detailed in the About the CD-ROM appendix and on the Software Media None of the material on this Software Media or listed in this Book may ever be redistributed, in original or modified form, for commercialpurposes Limited Warranty (a) WPI warrants that the Software and Software Media are free from defects in materials and workmanship under normal use for a period of sixty (60) days from the date of purchase of this Book If WPI receives notification within the warranty period of defects in materials or workmanship, WPI will replace the defective Software Media (b) WPI AND THE AUTHOR OF THE BOOK DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE, THE PROGRAMS, THE SOURCE CODE CONTAINED THEREIN, AND/OR THE TECHNIQUES DESCRIBED IN THIS BOOK WPI DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE SOFTWARE WILL BE ERROR FREE (c) This limited warranty gives you specific legal rights, andyou may have other rights that vary from jurisdiction to jurisdiction Remedies (a) WPI's entire liability and your exclusive remedy for defects in materials and workmanship shall be limited to replacement of the Software Media, which may be returned to WPI with a copy of your receipt at the following address: Software Media Fulfillment Department, Attn.: Instant Messaging Systems: Cracking the Code, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, or call 1-800-762-2974 Please allow four to six weeks for delivery This Limited Warranty is void if failure of the Software Media has resulted from accident, abuse, or misapplication Any replacement Software Media will be warranted for the remainder of the original warranty period or thirty (30) days, whichever is longer (b) In no event shall WPI or the author be liable for any damages whatsoever (including without limitation damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising from the use of or inability to use the Book or the Software, even if WPI has been advised of the possibility of such damages (c) Because some jurisdictions not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation or exclusion may not apply to you U.S Government Restricted Rights Use, duplication, or disclosure of the Software for or on behalf of the United States of America, its agencies and/or instrumentalities "U.S Government" is subject to restrictions as stated in paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause of DFARS 252.227-7013, or subparagraphs (c) (1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.22719, and in similar clauses in the NASA FAR supplement, as applicable General This Agreement constitutes the entire understanding of the parties and revokes and supersedes all prior agreements, oral or written, between them and may not be modified or amended except in a writing signed by both parties hereto that specifically refers to this Agreement This Agreement shall take precedence over any other documents that may be in conflict herewith If any one or more provisions contained in this Agreement are held by any court or tribunal to be invalid, illegal, or otherwise unenforceable, each and every other provision shall remain in full force and effect Important CD-ROM Information Use of the Forte for Java, release 3.0, Community Edition, Java Micro Edition Wireless Toolkit 1.0.3, and Java Software Development Kit Standard Edition version 1.4 for Windows software is subject to the Sun Microsystems, Inc Binary Code License agreement on page 685 of the accompanying book Read this agreement carefully By opening this package, you are agreeing to be bound by the terms and conditions of this agreement ... Messaging The Advantages of Instant Messaging The Need for Instant Messaging The Future of Instant Messaging Jabber Instant Messaging Model ... buddies, instant messaging will bloom into its full splendor Jabber Instant Messaging Model Jabber Instant Messaging system is different from other instant messaging systems, as it is based on XML The. .. involved in the exchange of data One stream delivers the data packet from the client to the server, and the other stream delivers the data from the server to the client The following code snippet