`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`M
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`IM applications
`
`
`
`
`
`
`
`
`
`Complete source
`code and design to
`create your own
`
`Dreamtech
`Software Team
`
`
`
`
`
`
`Page 1 of 6
`
`Samsung Exhibit 1026
`
`Page 1 of 6
`
`Samsung Exhibit 1026
`
`
`
`Instant Messaging Systems: Cracking the Code™
`
`Published by
`Wiley Publishing, Inc.
`605 Third Avenue
`New York, NY 10158
`www.wiley.com
`
`This bookis printed on acid-free paper.
`
`Copyright © 2002 by Wiley Publishing, Inc. All rights reserved.
`
`Published by Wiley Publishing, Inc.
`
`Nopart ofthis 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 paymentof 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 understandingthat the
`publisheris 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 trademarksor 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 mentionedin this book.
`
`Library of Congress Control Number: 2002106774
`
`ISBN: 0-7645-4953-7
`
`Printed in the United States of America.
`
`100987654321
`
`1B/QW/QU/QS/IN
`
`
`
`Page 2 of 6
`
`Page 2 of 6
`
`
`
`Contents
`
`PHOLACE ....ccccoccrsroccccccsrecscccesoocesesccescoscesoeccesersecceaascessscssasoosssacecsnssnecscassccsscesezcce WAL
`
`ACknowledgment..........scssessccesscesssesseescosesseaseosonsonssecossesesaceeessecevevooesoereccsoeeneXL
`
`Chapter 1: Introduction to Instant Messaging........ssssccsossssrssesecesssssceacesoseee
`
`A Brief History of Instant Messaging... ccccsesssesssessssesesensssscsseceescesesssesevesseuseanssensesevssanevsens 1
`The Advantages of Instant Messaging.........s:cscscsessssscssssvsssssvevecsessssssssvevssesassvecseconssnssrsersatacanees 2
`The Need for Instant Messaging ........cc.scsccsssssessssesrsesetssesessvessessessesesseesssesssevsseusasssseavsessasseasens 2
`The Future ofInstant Messaging ...0..... cc cecseccscscesssesesestseevsssesesesesesevesavesesesavavsnersseessnevanecevera 3
`Jabber Instant Messaging Model ......cc.cscssssesessssseecssetssesssesoresserssssssenssesessevesserecesseestesesesseanens 3
`Introduction to the Instant Messaging Application ........ccccessssscvssscscesvsscscsvesesesvsesersenscaenesaens 7
`Required Programming Techtniquesoc... cecsescesscccesetessescsenccesssceeseersvesaeesstsesesressesseecasereensens 10
`SUMIMALY ce ccscsssseccsesesesesssesssessseasesasesasescassecserseesenesauensssasessecsessearseessersverseavevesessseseseressecanesees 14
`Chapter 2: Designing the Instant Messaging Application...........0..+seovesoee LS
`
`Application Design Considerations .0......cscscseseeeeeecsenesenceseraseissesseersanscersusessesrsnenessessnsenes 15
`Database Design Considerations... cccccecseesesssesesessscseecseeveesaseseseseasescsivecscscscevsvavsvensacaveens 16
`Server Module Design Considerations ..0.....:.ccccsscssesssesscscsssessesseseseassavessearsonssenesesnsavscansuanevenss 16
`Client Module Design Considerations ......csccssssesesessessectecssessescasesesesessesesesasessasressssuevaneseans 36
`Application Communication Standards......ccccssccescsssecssssssssetsessssesssssssssssssssestsensssscsssssasersees 40
`Issues Involved in Creating the Session... cee vee seeeseeeescesesaevaserceesseesseassasnsssecseersensaees 45
`Issues Involved in Closing the Stream... ecsecseseecesssesestseeseesssesenssessrsesenssssessssesesseevesnages 46
`SUMUMNALY cs cesccssssscseesscesseesseessessesensssussceeseeeseeesessseasesgaeseseresessevscanscesessavsssereessesevenavesauecssessesaes 47
`
`Chapter 3: Instant Messaging Server (Java) ......ccccsscssccsesseesassosseesonscoonsness 48
`
`Java Web Services oo... scscsscesssesseessenssceersnecsenesensscescseassensosersaescaesssesssesenesseesesesevevesessessnases 48
`Server Development ..0..0....ceccesseseessesssssecsnssseseenenenssesssseaeaacsesesueassensssesesseseeseseevseencavessunssees 56
`Inside the Server Application ......secssseesesseereresatstesessssssescseesssesecavsssusscevassauesnstereesevaveraees 63
`Inside Java Web Services wiccsccscssseesissescecscsssessectserssensanersserstsesssnecsssenssssesensssesssseecseeseaes 91
`
`
`
`Page 3 of 6
`
`Page 3 of 6
`
`
`
`
`
`
`
`|
`!
`|
`
`
`Technical Documentation.........
`
`SUMIMALY ...ccsseecsscsrsessecsnesenersssssecseseesseersnenssetseenseensensseseseeneesersearseessearsnessensnennensneseseenteer eens 211
`Chapter4: Instant Messaging Server (C#).scsssssecsssrsssrssssssssseenseosseesseseeees 212
`Web Services wsta:sustusinistunansnntincuiaeutntaninianieieneiieiennnsnsnents 212
`
`Developing the Server.............
`Inside the Server Application... cccssseseeersserseeneensseerseesceseeeseerseensestestsnenenenaaeney 222
`Jnside a Web Service iscccsssssssessesssscsssssseerenrstensssescasesseesaueetesnesessesscsssessseseseessenesenssessseneeneey 237
`
`Technical Documentation...
`1 242
`SUMUMALY ....esccscsessecseeeeecsesstsseseesceneseesseneseasssensesenseeeesneseennseeneqneseneneaeeseegnessorscaneseaneasesseneenes eens 333
`Chapter 5: The Instant Messaging Cliemt (Java)....ssssscssssssevesceresessssseees IS4
`Basic Implementation of the Client 0... sssssereeseceerioneenessenseeesseeesereaeteey 335
`
`Establishing a Connection with the Local Server...
`1 339
`Programming Client Requests .......csccssscecseeseenesessessessenneseeeneensennenteneneccansanesseercanseasessenneas 341
`Handling Responses...csscssssscersrsssssesssrssssssecesesessesnsanesnesesesanensesiaseceraneseaerseererseneerseeraes 357
`Technical Documentation ......cccccsecsesrsenessseresensesessasasesseerenenteesensneasacaneenensaeisensrenesssersanseey 371
`SUMUMALY oo. cceeseeesesesesssstssssssseeseaneceeeseesensseanenenseneeseasessceeessenecauetonesosecenssusesenenseansasesenereensens 493
`
`Chapter6: Instant Messaging Client (Ci#).....ccssssssssenssssssneensersssscesessveseerses 494
`Client Module Tasks.......csccscesssecsessvessessssssssrsesssserssereserseseseneresevssesesersenssensienesaeesssnseenyags 494
`
`Server Responses....cessssesssssccnsesssesssssesssnesssessusssssseesveceesseesanneassseennecssasessaeseasnees
`1 508
`Technical Documentation .....ccccccccecsssescesesestssersessesseconssenesssnsceseserssereeseoneeenesnenesenceeesensegy 519
`SUIMIMALY ......ccsessessesceeceseseeereeesessesesesesescsaresescanesecaesessecsecsesisseseeessseceaenestaencanesenseanasesessesntanteas 623
`Chapter 7: Enhancing Instant Messaging.....csscssssecsssssssssessssessssssecssensessees O24
`
`we 624
`introduction to J2ME ...csccssessecescsertenssecresssssesscersesesessesesenerseaseaenteageasasearserennats
`Design Techniques......c.csscscssssvsssscsesesssssesssensacsssesssnssessssnessanscanecsenensssousscanessarcoserenesasennsenas 632
`
`Programming Client Requests .......cccccccseeesesesseeseeeseerseersesneneceeieereaneieaereaeseataeseeney 645
`Handling Responses ........csssssessrssesssresessseersssssseessnesssnsscersnesssnenssesetacasressssenneaeseracneqsesensrseeees 650
`
`SUMMALY oe. eesrsterseereeesenenseeneeaes
`Appendix A: What’s on the CD-ROM.........ssssssssssserersessssrsssssscsesssseesessseees OST
`
`Appendix B: Instant Messaging Software Resources...orssosssoserseeenseeoseeee 667
`TNX ...cccccccsssssssscesscscecncosscsssssovosssssacesesssscssescoassssssnsscssssacszsnssassanccesssecasecerees OOD
`
`2
`
`Sun Microsystems, Inc. Binary Code License Agreement............scessse 685
`
`|
`
`|
`|
`
`|
`
`
`
`Page 4 of 6
`
`Page 4 of 6
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Wiley Publishing, Inc. End-User License Agreement.....sccsesssscssssessssscooes702
`
`Important CD-ROM Informmation,....ccscssccssssscerserosssesessssssssesssssesescasscscceses 704
`
`Page 5 of 6
`
`
`
`Page 5 of 6
`
`
`
`
`
`
`
`
`
`:
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`'
`
`|
`
`Chapter 1
`
`Introduction to
`instant Messaging
`
`Instant messaging (IM) 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) andthe popularity of handheld
`devices such as mobile phones, Short Message Service (SMS) added a new dimension to
`instant messaging integration.
`
`SMSrefers 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 wassent in
`
`December 1992 from a PC to a mobile phone on the Vodafone GSM network in the U.K. Each
`
`
`
`short message ranges between 70(1160 characters.SMShasa store-forward capability; this
`means sending messagesis possible even whentherecipient is not available. The useris
`notified when a messageis waiting, as with voicemail.
`
`
`
`: :|:
`
`|
`
`Integration of SMS andinstant messaging allowsyouto deliver short messages by using the
`instant messagingfacility over handheld devices. Today, instant messaging canbe availed free
`of cost. Software giants such as Yahoo!, Microsoft, and AOL are already offering free instant
`messaging facilities.
`
`|
`|
`
`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 launchedits own version of instant messenger
`with a component used for managingall the incoming and outgoing messages andthelist of
`friends. This component is popularly known as buddy list. Soon, Microsoft and Yahoo!
`followed AOL'strail. 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 wererestricted 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
`
`