`
`c::0 £5
`
`((2 g” (0’5(2. (D 2
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`i )M
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Complete source
`code and design to
`- create your own
`
`Dreamtech
`
`Software Team
`
`
`
`
`
`
`IM applications
`
`
`
`
`
`
`
`
`
`Page 1 of 6
`
`Samsung Exhibit 1026
`
`Page 1 of 6
`
`Samsung Exhibit 1026
`
`
`
`Instant Messaging Systems: Cracking the CodeTM
`
`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-Mai1:
`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.
`
`10987654321
`
`lB/QW/QU/QS/IN
`
`
`
`Page 2 of 6
`
`Page 2 of 6
`
`
`
`Contents
`
`Preface
`
`vii
`
`Acknowledgments....;............ ................
`
`......
`
`......
`
`Chapter 1: Introduction to Instant Messaging
`
`A Brief History of Instant Messaging ...................................................................................... .. 1
`The Advantages of Instant Messaging ..................................................................................... .4 2
`The Need for Instant Messaging .............................................................................................. .. 2
`The Future of Instant Messaging ............................................................................................. .. 3
`Jabber Instant Messaging Model ............................................................................................. .. 3
`Introduction to the Instant Messaging Application .................................................................. .. 7
`Required Programming Techniques ...................................................................................... .. 10
`Summary ................................................................................................................................ .. 14
`
`Chapter 2: Designing the Instant Messaging Application
`
`......
`
`Application Design Considerations ....................................................................................... .. 15
`Database Design Considerations............................................................................................ .. 16
`Server Module Design Considerations .................................................................................. .. 16
`Client Module Design Considerations ................................................................................... .. 36
`Application Communication Standards ................................................................................. .. 40
`
`Issues Involved in Creating the Session ....................... ..’. ....................................................... .. 45
`Issues Involved in Closing the Stream ................................................................................... .. 46
`Summary ................................................................................................................................ .. 47
`
`Chapter 3: Instant Messaging Server (Java) .. ....
`
`......
`
`........... ..48
`
`Java Web Services ................................................................................................................. .. 48
`
`Server Development ........................................................................................................... .. 56
`Inside the Server Application ................................................................................................ .. 63
`Inside Java Web Services ...................................................................................................... .. 91
`
`
`
`Page 3 of 6
`
`Page 3 of 6
`
`
`
`
`
`
`
`Technical Documentation ....... ..
`
`
`
`Summary .............................................................................................................................. .. 211
`
`Chapter 4: Instant Messaging Server (C#)
`
`212
`
`Web Services ....................................................................................................................... .. 212
`
`
`Developing the Server............. ..
`Inside the Server Application............................................................................................... .. 222
`Inside a Web Service ........................................................................................................... .. 237
`
`Technical Documentation .............................. ..
`242
`
`Summary .............................................................................................................................. .. 333
`
`Chapter 5: The Instant Messaging Client (Java)
`
`Basic Implementation of the Client ..................................................................................... .. 335
`
`Establishing a Connection with the Local Server
`339
`Programming Client Requests ............................................................................................. .. 341
`Handling Responses ............................................................................................................. l. 357
`Technical Documentation .................................................................................................... .. 371
`
`Summary ........................................................................................................................... .. 493
`
`Chapter 6: Instant Messaging Client494
`
`Client Module Tasks ............................................................................................................ .. 494
`
`508
`Server Responses ............................................................................................ ..
`Technical Documentation .................................................................................................... .. 519
`
`Summary .............................................................................................................................. .. 623
`
`Chapter 7: Enhancing Instant
`
`624
`
`Introduction to J2MB ......................................................................................... ..
`
`Design Techniques ........................................................................................................... .. 632
`Programming Client Requests ............................................................................................. .. 645
`Handling Responses ............................................................................................................. .. 650
`Summary ......................................... ..
`
`624
`
`
`
`Appendix A: What’s on the
`
`Appendix B: Instant Messaging Software Resources
`
`Index
`
`657
`
`667
`
`669
`
`Sun Microsystems, Inc. Binary Code License Agreement........................ 685
`
`
`
`Page 4 of 6
`
`Page 4 of 6
`
`
`
`
`
`
`
`Wiley Publishing, Inc. End-User License Agreement......702
`
`Important CD-ROM Information.. ....
`
`.....................................704
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Page 5 of 6
`
`Page 5 of 6
`
`
`
`
`
`
`
`
`§
`
`‘3
`
`I
`
`Chapter 1
`
`Introduction to
`
`Instant Messaging
`
`Instant messaging (1M) is an Internet-based protocol application that allows one-to-one
`communication between users employing a variety of devices. The most popular form of IM is
`chatting, where short, text-based messages are exchanged among computers. With the advent
`of technologies such as Wireless Application Protocol (WAP) and the popularity of handheld
`devices such as mobile phones, Short Message Service (SMS) added a new dimension to
`instant messaging integration.
`
`SMS refers to sending and receiving text messages to and from mobile telephones. The text
`may be composed of words or numbers or may be an alphanumeric combination. SMS was
`created as part of the GSM Phase 1 standard. We think the first short message was sent in
`
`December 1992 from a PC to a mobile phone on the Vodafone GSM network in the UK. Each
`
`
`
`short message ranges between 70 160 characters.SMS has a store-forward capability; this
`means sending messages is possible even when the recipient is not available. The user is
`notified when a message is waiting, as with voicemail.
`
`
`
`§ is5
`
`,!
`
`.
`
`g
`
`E
`
`i
`
`
`3
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Integration of SMS and instant messaging allows you to deliver short messages by using the
`instant messaging facility over handheld devices. Today, instant messaging can be availed free
`of cost. Software giants such as Yahoo!, Microsoft, and AOL are already offering free instant
`messaging facilities.
`
`l
`1
`
`A Brief History of Instant Messaging
`Instant Messaging has been around for more than two decades. The first major player to enter
`the arena of Instant Messaging was AOL, which launched its own version of instant meSsenger
`with a component used for managing all the incoming and outgoing messages and the list of
`friends. This component is popularly known as buddy list. Soon, Microsoft and Yahoo!
`followed AOL's trail. As a result, MSN and Yahoo! messenger appeared on the market with a
`variety of impressive new services. In its early days, instant messaging uses were restricted to
`splashing messages on bulletin boards. Gradually, instant messaging became a major area of
`interest for youngsters. Society acknowledges instant messaging as the most common means
`by which people of varying age groups, especially youngsters, communicate with one another.
`
`
`
`Page 6 of 6
`
`Page 6 of 6
`
`