`
`(on en
`Talk
`Bh
`
`:
`Combine the powerof Ege Bent
`Elaclaee
`
`
`
`Mark Nadelson & Tom Hagar
`
`Zynga Ex. 1015, p. 1
`Zynga v. IGT
`IPR2022-00368
`
`
`
`C++ Objects for Making
`UNIX and WinNT Talk
`
`Mark Nadelson and Tom Hagan
`
`CMP Books
`Lawrence, Kansas 66046
`
`Zynga Ex. 1015, p. 2
`Z
`I
`ynga v.
`IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 2
`Zynga v. IGT
`IPR2022-00368
`
`
`
`USA
`
`Designations used by companies to distinguish their products are often claimed as trade-
`marks. In all instances where CMP Booksis aware of a trademark claim, the product
`name appearsininitial capital letters, in all capital letters, or in accordance with the ven-
`dor’s capitalization preference. Readers should contact the appropriate companies for
`more complete information on trademarks and trademark registrations. All trademarks
`and registered trademarksin this book are the property of their respective holders.
`
`Copyright © 2000 by CMP Media, Inc., except where noted otherwise. Published by
`CMP Books, CMP Media,Inc.All rights reserved. Printed in the United States of Amer-
`ica. No part ofthis publication may be reproduced or distributed in any form or by any
`means, or stored in a database or retrieval system, without the prior written permission
`of the publisher; with the exception that the program listings may be entered, stored, and
`executed in a computer system, but they may notbe reproduced for publication.
`
`The programsin this book are presented for instructional value. The programs have been
`carefully tested, but are not guaranteed for any particular purpose. The publisher does
`not offer any warranties and does not guarantee the accuracy, adequacy, or completeness
`of any information herein and is not responsible for any errors or omissions. The pub-
`lisher assumes noliability for damages resulting from the use of the information in this
`book or for any infringement of the intellectual property rights of third parties that
`would result from the use of this information.
`
`Cover art created by Robert Ward.
`
`Distributed in the U.S, and Canada by:
`Publishers Group West
`1700 Fourth Street
`Berkeley, CA 94710
`1-800-788-3123
`
`5
`
`.
`
`ISBN: 1-929629-07-9
`
`R&D Developer Series
`
`Zynga Ex. 1015, p. 3
`Zyngav. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 3
`Zynga v. IGT
`IPR2022-00368
`
`
`
`9°781929 62907
`
`Learn how to use these advanced techniques that provide features
`not inherently available from pure sockets.
`= Remote Procedure Calls (RPC) that call a procedure from an
`application running on one machineto execute on another
`Remote Execution (REXEC), the daemon residing on UNIX
`workstations, provides a powerful communication channel
`requiring user authentication
`File Transfer Protocol (FTP) with feature-rich customfile transfer
`SMResas
`Cross-Platform Semaphores that can protect shared feelers)
`resources, or facilitate multi-platform processes
`Shared Memory processes that can write and read from a central
`resource Independent of each other
`Pipes for process-to-process communications that transmit pele
`recelve data using standard input and output file descriptors.
`Publish and Subscribe application frameworks that allow UNIX
`and NT to communicate without customizing message sending
`and translation,
`
`NETWORK PROGRAMMING
`
`Want to reduce your overall cost of ownership? The object-oriented
`techniques for cross-platform communications presented in this book
`will enable you to develop applications capable of accessing functionali-
`ty located on either UNIX or Windows NT
`
`This book delivers an in-depth look at cross-platform techniques
`beyond socket communications.It builds on the authors’ creteT=) an
`Making UNIX and Windows NTTalk. which demonstrated how to
`UDP and TCP socket communications to implement cross-platform
`tems na sre ORT =) AY of run-time environments
`
`49070912365
`
`O00B8907091236
`
`_ IpisxKg)
`ENCLOSED
`
`C++ Objects for Making UNIX and WinNTTalk is a practical gqui¢
`implementing object-oriented cross-platform communications. Es
`eset VelASpapie la cole te le—icmc Mea chmereseteiclal mech delE-bralclemnaia] supporting architec:
`mumcations, digital signal
`tural drawings, C++ classes, and working applications. You learn how
`fo create increasingly sophisticated C++ inter-platform objects that will
`processing, internet
`enable you to implement cross-platform communications bee MoleCeF ee
`ety of architectures — single-threaded, m ulti-threaded, and Windows-
`based applications,
`
`programming, and financial
`institutions. It is in their
`
`development of mission
`
`critical applications for finan-
`cial institutions, where legacy
`UNIX systems are wedded to
`
`Windows NT workstations,
`
`that they have honed their
`
`skills in inter-platform
`communications.
`
`C++ Objects that you can plug into your own applications are
`supplied on the companion CD-ROM.
`
`CMPBooksis an imprint of CMP Media. Inc.
`Other fine publications in the CMPfamily include:
`.
`SA
`
`OhHt regi al
`
`
`
`CPAP hooks’
`
`R&D Developer Series
`
`$49.95 © ISBN: 1-929629-07-9
`
`|
`
`54995
`
`ynga Vv.
`
`Zynga Ex. 1015, p. 4
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Table of Contents
`
`RYBTSCG.!
`
`bi hiie.i's ote e'eitiar ais -z:e'are-acs eaecs acnate dd ad ew ae ix
`COERONEINGE:
`8 oira.sctart dad ahs nA ea aol p
`a Sheth Ati Arete ta xi
`
`Introduction.................000ccc cee e cece ewees 1
`Chapter 1
`1.1 Overview of System Application Tools ...........--0 5 eee ceececeuveees2
`The UNIX and WindowsNT File System... ......... 0000 cc ee eeeeeee2
`UNIX and Windows NT Run-TimeSignal Processing ................. 9
`Windows NT and UNIX Semaphores................020 cece ceeues 14
`Windows NT and UNIX Threads, 0.00.5 .ccssceevceevuseuecnoss 18
`Windows NT and UNIX Process Spawning .........2-.000eeesceees25
`Li2. Overview? af internét Protease 0.0% 5 ccnvaale 5 vineais dames Folsle maw Gass33
`TCP/IP aad the OST Model ons canis posed wes sake toe nae eaaceea’ 33
`PRECerCR FOSS yc sche assy ng 50,9 % ators eehaae ee QB REE Rad aot ual 35
`ERE SUBTCE AGAR 53 bd ook Foc nse BA RRO PRE RIMES REV. Qarictams 35
`FNEEHICHO SEE9Gur.
`s Vin'dsin.e valve er uipacg maple Oe see GREE a TOE Ra36
`UDP versus TCP Process os sass Sirs ode cies Aslam acictalna, diiaveew lee37
`POL SETS sro ry cia sale OME Yee MSAD ae Flatware wma SBT aE37
`LS*Socket ConingacanOn 207 jas vse teen kw nae india PARERSMURR ETS aie38
`PTUCEGED ACMIphyie's Sielsistal tale sere aoe NIRA Bars F OUEKETEAT E-H8 Farah38
`BYE CeIn etirs 9st, op Soe xk, 8K ote auth wae BIE ph ald Mh
`a ARE RINT» Store38
`LE eras 1Ce RRtied assis sien aes oe e paSGia es Nn aeniee 25a Paras41
`WAMNG SMSOENS Sac dice greece theca toys meu eug Tanla lo, 216, Saglianw ie, ayben ata ke amr eloes« .s42
`Customizing Socket Operations .........0 csc cence ence eee ceneeee 50
`
`Zynga Ex. Hi? p.5
`Zynga v. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 5
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Choosing The Right Communication Protocol For the System......... 82
`Choosing the Appropriate Cross-Platform Communication Method .... 82
`1.5 Overview of Cross-Platform Communication Methods...............-. 83
`RemoPeaceciite tialls3 secczcicgras cacy ta bohapead ss Guep-hads 83
`Remote Execution (RES) so scsae 0a aoe yeow ae aera al
`wp eve Ridio a eee miss Bue 84
`SeMANhGrEs,'s si5 haces stag SeI CRM ESDE De MOL ETA S Sma R Das 84
`Pile SATIN: + unwed edacsa em dx gusay as cd aed edaeu olen 2 pitied 84
`Shared MEMOVY : iaisis ab dae Ree aa de es OA ad a eath aoa a Hele ed 85
`PEGS 3s
`.2se- tgieie wg ee ahs terp sia esos wreis Roba, cry Sg eye tes eee ey 85
`Transferring Data Between Clients and Servers Using Generic Messaging. . 86
`1.6 How This Bookie Presented, 5.30 oe 55 aay ie eee a es eas ge ens 86
`Orie Fitial Wotd iit acdc int ce dea id obeaneadid ie aeete ate bkae Pas 87
`
`Chapter 2 Interplatform Communication Using Remote
`Procedure Gallas 6 Sistah tai awialanta wey os baeee nets eee 89
`O01 a ONETVIEW OE RPSS:...c pa ssdame eae sche Sep adg edie Dba deaRaien don 90
`Logatnit the Srvet sec. th srt ie as YRC KRU vol ee EROS REY 92
`EPC and the OSI Network Model. .c.csc ieee es 4ogoa ck bao aad 4 94
`RING. RPGs 5 seraprarqlevicigs sy's Ge Rese ye Ae SREY weiss Satay ity 94
`Passing Data To and From the RPC Client and Server ..............- 94
`ONG RPC Communication-Protncdls,. css .5 05 s.0su9 sea ey Sula ws 96
`2.2 RPCGEN: The ONC RPCProtocol Compiler.............0 000s eae 96
`2.3 The ONC RPC Interface Specification Language. .........06-0eeeeuee 100
`The Constant Petition. JeG.cce ch occ3G welateasaasceeessaekan 100
`‘The Enumeration Debmiieis sci ch i ata ea CARTES eT ese aa ERE 100
`Thesiectie Detinition 22. i caaa¢ 2
`+ oem mwcis Rebels 85,006. Be miyi 212 101
`ENS LINC AARIION Cis gts eS. tia ERAS SERS OR ETRE PASS APs ET 102
`SLUG PRES DCIS fe 25 649. Hara E OD EPRI SE Ree S OA 103
`The Progtamt Detititicnhc..cocsdencdasactaled Chis BOL ee ae eT 104
`Additional RPCL Variable Syntax Definitions .........0.0-00000ee 107
`2.4 Creating an RPC Client/Server Application... ........ 00: e seen enenee 108
`Connecting and Disconnecting from the RPC Server .............5- 108
`Manipulating the CLIENT Structure Definition .............-000005 110
`Galling the Remote Procedure. 6 visa ates a0 dante tae ole wand ae a eee 111
`Finding The Best Loan: A Simple RPC Client/Server Application ...... 112
`2.5 Transferring Arrays and Linked Lists in an RPC Cross-Platform
`ASPISSHON Wil edd .hauwe tise CEA IRS AG we eA ER ADO Sead 129
`Sending a Fixed-Length Loan Amortization Schedule............... 130
`Zynga Ex. 1015, p. 6
`Zynga v. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 6
`Zynga v. IGT
`IPR2022-00368
`
`
`
`5 nis aiae iad a ese oahe Sate tala gdp dnserp cen aa 159
`ExitthGRPO Lear CCRC se
`Processing a Doan Query:
`+ seul ae Pes see eee Lae esa ee 160
`Multithreading the RPC GUI Client..............0000 5 cece eens 163
`2.7 Multiple RPC Server Comrnecttons <u oxcay cedex cae es oo eos Hee ay eed 167
`The Multiprocess RPG Server. 205. 2 .2os cca p
`i dectiag ems caremaaes 167
`Multithresdigr The RPC Server y...e vite pdade ses eee av tas PEemEeeS 172
`Desy RSCUGIIACODEES s
`s9l
`5
`5, 0At ators b> Gehrke tla Si Ne ON NREL eh ees ees talg CNSR o.maries ane 182
`
`Ghenters)RENE ors tose shee ets ct TKR cae nthe 183
`Bil. AEDSHIGE 5c oa cig visa ale ra Ee RETR Meee Velde whe TAS Be oes 184
`3.2 Creating an REXEC PC Client Using TCP Sockets ...........22.000 00 185
`he Seo kecceSopp hiss a hcs aes olen aaa bles da eee ceer reams 186
`XPCRexecSetup Private Methods. ............000cenecanaauneaees 188
`XPCRexecSetup Public Methods: . icc causavaacccaassaacdsdcaaws 191
`A Sample Client/Server Using the XPCRexecSetup Class ............-. 195
`3.3” Thteadige thy REXEG BG Cine ccc ann dace au men te eo ae ale be eee ee201
`The Threaded PC Client: Main Progratti..s...<c0:0 esr a0es aeta cee ours205
`She Thread Function .c.c cas ose sea say iekdakeoattaneshlordaaned207
`Sat Wena EBS APE oo eras ten arrange ete Bee a ea p
`tate alates eae sue ep 209
`The New XPCRexecSetup Constructor ..........00 cece eee eeeeuees209
`heew NREMEECT BACHE aii siete cite 9
`ta'pe ote elev We ip eee ree aiegiae210
`3.5 Creating an REXEC PC Client Using Windowsand Asynchronous Sockets . .210
`Asynchronous Socket XPCRexecAsyncSetup Class........0ce ecu eeuee212
`The Tin PO Windows Glignts i. cscs esceaa dude ae SRE db weal Bada ee 220
`Te LIDS Server suis siig sav teh blade eaeldlpt niet aea bibdate solace 220
`Tie Pe Chien Diale® Code:
`« s'sicccnntas ta avcht wanted eo dees 222
`Connecting to the Server ....... cat
`ay scalp ts
`Wy pce tea ot ae ld 223
`VRSSU ERS LOGGED oF cine bag ocaaas otag oh y ee Pg Gia s ermucses 225
`aS OURCHISRON vy 5 aevradatele siecn chip eaia ene ne RUE PEEL lan Eees eagses 228
`
`Chapter 4 Cross-Platform Semaphores ..............0000:5: 229
`Hel Unteretaais 9 aso. esa aie 1d, Cite Pent ped ae BND bin RUN ere ala &.Ga.m5 230
`4.2 The Cross-Platform Semaphore Architecture... ..........400ee0 ee seee231
`4.3 Cross-Platform Semaphore RPC Interface Specification ................233
`4.4 Cross-Platform Semaphore XDR Translation Routines..............00237
`4.5 Creating a Cross-Platform Semaphore Client ............. 00000 e cues239
`4.6 THe SenAphONe. SEVER 5 5 ax eeleaine wae rs nak ee aly os alms HE eta are245
`The Semaphore Server Remote Procedures. .........0000ee0eeeeees249
`
`Zynga Ex. 1015, p. 7
`Zyngav. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 7
`Zynga v. IGT
`IPR2022-00368
`
`
`
`vi Table of Contents
`Remote Procedure Semaphore Access Procedures...+-s+eee8eeee ee? 251
`4.7 Synchronizing Execution of a UNIX and Windows NTSystem....-++-+ 259
`World Wide Web Price Publisher ....----+-++recrrerrrrrtcrt 259
`Seas Brice Server’ seid irae sine ees NS PAwED BE SEES MENS? SEE 263
`BS CneGOUens. fate vie ve be 3nd RA EE EASE TARR EE RIEL TS ON 268
`Chapter5 File Transfer... -.0ee eee e creer err enseeresess 277
`51. File Transfer Using FIP... 22 .c0 esc csmaieee saree fee rne arenes 278
`MPEETPETEND CIASS ela vers ae AES STM wee nas See Se 278
`YPCETPClient Comstructor ......-++eeeerte rr rretere sess 279
`¥PCFTPCIient Constructor ...iccns ces cee eee reanesnecees cess 282
`The vLogin() Method ..csccecsesceereaet tinge nersmnceene rere 283
`The vPWD() and vCWD() Methods ...-..--seseeeecetterreresetss 283
`The vAscii() and vBinary() Methods .o..24 se0s%s%22 Chr aneneee 285
`The vGetFile() Methods... ..05-0200s5ceeles nen eene nas rreeees 286
`The ListenSocket() Method ...-.---e+-eesterreersrsrssseeees 288
`The VTSECT MEPHOM joven nee nF ode ales etre Ane eo ne BEAST? 290
`The yPutFi lel) Method... .isceseccaeteeseea corer were eresree® 291
`¥PCFTPClient Example......----esseeereeserer esters 293
`$9. File Transfer Using Sockets ...2.s¢s0s0es0deeeesee new eseeenreeres 295
`XPCFileTransfer Class. .....+ssseestenreeearewererescseene® 295
`XPCEileTransfer Client Constructor ..-..-+-+-errrrcretsrrret 297
`XPCFileTransfer Server Application ....++++++errrrsrscrrrrr ess 305
`XPCFileTransfer Client Application. ..-..++-+sseerrerrtterreet 308
`5 CenchGRMN ine we ack aad agg Bg ar Be ee weet SR Te eS 312
`Chapter 6 Cross-Platform Shared Memory ...-----:+s+0'" 313
`EA Teroduchon cries Gx earemae's awh ees hee Sans ERMA Te Sa e TEs 314
`6.2 Shared Memory on UNIX... ..--. see eeseetereerersermesenene es: 316
`Shared Memory CommandLine TONS vic acia caw Selah ee Ste ers eae 318
`The xPCSharedMem Definition ......+++++eecceertrresrestertt 319
`An Interprocess Communication System Using XPCSharedMem .....--+ 323
`The Personnel Entry Server... ..-0cscesene eee eseenreneennenes 324
`The Personnel Entry Client.....:2sse-eeeesenenteeoeueereeercss 327
`6.3 The Architecture and Data Structures of the Cross-Platform Shared
`AAemoty Serveie casey cnt h lee ase tae eres Ae ze seers se 330
`The Cross-Platform Shared Memory RPC Interface File.....+--++++ 332
`6.4 Developing the Cross-Platform Shared Memory Server..-.-++-+++s520> 337
`The crossplatformmem_1() Procedure: iiss aecdesaee ede te hheines 338
`The Remote Procedures Defined... ...+-++sssererreeerreerreees 341
`Processing Multiple Client Connections ....-.-0+eees renee ereeees 347
`Shared Memory Server Error Recovery. ---++++++++ereterrsrtees 348
`
`Zynga Ex. 1015, p. 8
`Zynga v. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 8
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Table of Contents Vii
`
`6.5 Creating a Cross-Platform Shared Memory System....---+++++5eerrre>349
`Steps for Creating a Shared Memory Glec:Ca eee a349
`Protecting Access to Cross-Platform Shared Memory....-+++++se+9%:354
`Application Example: Simple Purchasing and Confirmation System. ....356
`The Confirmation Server ....--- see e eee ec eee e eter r ere eneees361
`The Purchase Order Client.......---20 eevee etre re reece eesees367
`6.6. Condlagion ..c.c oc ee ea ea Sia pene ete RTE TEESE ARTO NSS373
`Chapter 7 Cross-Platform Pipes......--++++++s5rrrerctres 375
`7A)
`lateodchon «vaiecd ioe 0x aided eee bh neem aes es Sa ethe se Ohms Hee376
`7.2 Using REXEC as the Pipe ......--- Mi 3p CAGE ERRORS eee med gan378
`Developing an Interplatform Pipe Communication System Using
`BRMEC. cos clita sd oka Rep este iam are ee Gees379
`Application Example: Controlling Remote Processes Using
`(PERGKOCPIDE 0. dec aweee Dee ee Ta ssa ea eee ee Eg NEY382
`7.3 Creating the Spawn Server ...-- ++ 0 see eeec tee eeesr ete seers rs seees399
`The UNIX Version of the Spawn Server. ...--+ee ee eeeeeeeerereees404
`The Windows NT Version of the Spawn Server ...--- ++ e-+seererres415
`7.4 Cross-Platform Pipe Client and Server. ...--...0ee0esserrretrerreses415
`The VPCne CLASK cs a cb sexes eal eed aes rte d pa Gea Wore Haas eas416
`The XPCPipe Class Constructors.....-..seesssreerrrreeesretses418
`Accepting Pipe Connections .....-.++++eseseeeereseressetssesss419
`Communicating Using the XPCPipe Class ...----+0+ +e seeeeerrersss419
`Example: Direct Communication Using NPCPTDG aa se xdsaearetoa seas421
`The Process Controller Server... ... eee eeee cree e rere eer see sees421
`The Process Controller Client. .......---s esses eeer eee rete recess431
`Spawning and Communicating with Remote Applications........+---435
`The XPCSpawn Constructor ....-ssse seer ete eeeense resets ceress436
`Integrating XPCPipe and XPCSpawn ..-..+seereesereerrseresserees439
`Example: Creating ProcessControlServer and ProcessControlClient
`Using XPCPipe and XPCServerSpawn ...-++.+e-eeereerereeseres442
`a5 Conclusion oaslals sla ba. ne eed ppe sie oe He SERRE EAS Sse tase eer ese455
`Chapter 8 Cross-Platform Publish and Subscribe .......-+--- 457
`Fl) WAtrOduetiN no ccs sesrcies Pee R ae edna eC ERs ERAN ETS Shee HATES S458
`82 Publish and Subscribe ......-. 00s seer ese eee rn etree eee eceneeeaes459
`The Anatomyof a Published Message ..... +++ ++2e+eeeerrrrerteee460
`How to Create, Publish, and Subscribe to Messages... -. +++ +++++++05462
`8.3 Creating the Generic Message Class ......+++++0eeeerersreerrsceess463
`The Header Component... ....0--eseeeeeer reese eee enerser esse463
`The Body Component ....+..0eseeereeeeneee eter neserrrc eens.467
`Putting the Message Components Together in XPCMessage....----+++-472
`¥PCMessage Constructors ... 66. ee eee eer eter eee eee esters css474
`
`Zynga Ex. 1015, p. 9
`Zyngav. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 9
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Vili Table of Contents
`
`Inserting, XPCComponentOBpects aacssanaae tae dna dadowe saw die ans 478
`Retrieving XPCComporient Wales as ccs cw peas eo Ras Sees nea ene 479
`Publishing, Subscribing, and Receiving XPCMessage Objects.......... 485
`8.4 The Publish=and-Subsenibe Server cs yack oda ve ee ioe ¥ He Eee Re Kaas ys 487
`8.5 Creating a Publish-and-Subscribe System. .........-000000 eee ee eeee 490
`Overview of the Sample System .........0-.0 ccs e eee eeecevecene 490
`Phe News PubMeberes 25 scis.ch ci sieceisis.cie ceiesik Glare Ryarsieep aie asiece 498
`ERE EWS SUSDEES once. ds rte ere CS Riesy COSA CoS TOAD aes 2 505
`Single-Threaded News Message Retrieval...........-..0000 ee eeee 505
`Receiving Messages on Multiple Sockets.... 2.0.0... 0.0 e eee ee eee 509
`Threading Message Retrieval .......--ccc0ess ee rascereaeeecees 514
`Asynchronous Message Retrieval Within a Windows Application ..... 522
`Mite KenmCleeaerc staicigsoralale aetaisbesa ah
`& ddl avery aA G Meisheuel te SSI WA sian desea, 2 533
`
`Appendix A UNIX Run-Time Signals ....................055 535
`
`Appendix B The Sample Code and Files on the CD-ROM....... 541
`B.1 Compiling and Executing the Example Applications.............-.+.- 543
`
`SHLOSSATWN
`
`(2.5 913.6 38106. 68 eR ard dni deter ils Bk gibi Diente ane 545
`
`BNOQUADNY s
`
`-
`
`6 costo s chs contact +4 emda ase eo ROE SO9G 551
`
`0EE
`
`ROR Pet ete oh Beene CR eee ne ae Ka Pa aE es 553
`
`What's on the CD-ROM?..... 0... 0.0.2.0 eee eee eens 580
`
`Zynga Ex. 1015, p. 10
`Zynga v. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 10
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Zynga Ex. 1015, p. 11
`Zynga v. IGT
`IPR2022-00368
`
`
`
`This material may be protected by Copyright law (Title 17 U.S. Code)
`
`
`
`458 Chapter 8: Cross-Platform Publish and Subscribe
`
`server on both UNIX and Windows NT andSection 8.5 shows how to developa cross-plat-
`form publish-and-subscribe system that passes generic messages.
`
`8.1
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Introduction
`Oneofthe greatest difficulties with cross platform communication is properly aligning data
`structures and adjusting for big endian/little endian differences. In previous chapters, these
`difficulties have been overcome by using one of two methods. Thefirst methodis to force all
`elements of the communicated data structure into character arrays. A character is a single
`byte and has no ordering issue. Both UNIX and Windows NT align character arrays to the
`nearest byte implicitly, correcting the byte alignmentissue. Integrating multibyte data types
`such as integers within a data structure causes the resulting data structure to align differently
`dependingon the operating system beingused.
`The second method used to overcome thestructure alignment big endian/little endian
`problem is to encapsulate multibyte data types within the XPCEndian class (See Chapter 5 of
`Making UNIX and Windows NT Talk). The XPCEndian class converts multibyte data types
`into a character array. This can be done because a multibyte data type is stored in memory as
`consecutive bytes — exactly the way a characterarrayis represented. Converting to character
`arrays avoids structure alignment issues. The XPCEndian class also contains methods for
`reversing the ordering of bytes so that endian issues are avoided.
`Although the two methods — character arrays and the XPCEndian class — overcome the
`problemsrelated to sending data structures between UNIX and Windows NT, a common
`complexity still exists. All methodsof interplatform communication used thusfar require cus-
`romizing the client and server’s method of sending data structures. Both applications need to
`know the data structures being sent and received and how to decode them once received. In
`previous applications, decoding transferred data structures was accomplished by encapsulat-
`ing the transferred data within an object, whereby the object contained methodsfor correctly
`storing and extracting the data elements.
`‘A maintenanceissue arises when using the sameclass in twodifferent places. If the class 1s
`changed ontheclient bur not on the server, the system ceases to function correctly, The fix for
`
`this situation is to update the data class on the server side, immediately followed by an update
`
`ontheclientside. If only oneside is updated, disastrous results may occur. The need to change
`
`the data transfer class on one system butnoton the otheris a realistic situation. For example,
`
`if the application that receives data needsto store information regarding the data’s source, the
`
`data class storing the incoming messageis a good place to put this. Unfortunately, increasing
`
`the size of the data class results in errors when attempting to transfer the same data object
`
`back to its source since the target of the transferstill maintains the original data structure.
`
`Another methodof interplatform communication overcomes these problems related to
`
`data transfer, The data structure alignment andbig endian/little endian issues are avoided by
`
`incorporating character arrays and XPCEndian objects into the method. Theissue regarding
`
`the maintenance of data transfer objects across platformsis also avoided through the use of
`a generic messaging framework. The generic messaging framework enables data objects to
`be transferred between client and server applications regardless of the type or amount
`data. The creation and use of the generic messaging class framework arethe focal points ¢
`this chapter.
`
`
`
`
`Zynga Ex. 1015,p.
`
`Zyngav. IG
`
`IPR2022-0036:
`
`Zynga Ex. 1015, p. 12
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Publish and Subscribe 459
`
`8.2 Publish and Subscribe
`The generic messaging class framework uses the data transfer concept of publish and sub-
`scribe. The basis for a publish-and-subscribe system is as follows.
`* Processes receiving network messages subscribe to all messages they want to receive. The
`subscription is accomplished by using a label that uniquely identifies the message being
`transferred.
`* Processes sending network messages publish their messages using a uniqueidentifier. If the
`process receives a message whoseidentifier matches the one subscribed to, the messageis
`stored; otherwise, the message is discarded.
`Figure 8.1 illustrates the basic architecture ofpublish-and-subscribe system.
`
`Figure 8.1
`
`Architecture of a Publish-and-Subscribe System
`
`Subscriber
`Publisher
`
`Subscribe toall
`
`Create a New
`
`
`Messages with a
`
`Unique Identifier
`"A"
`
`
` Publish the
`Message Using
`
`the Unique
`
`Identifier"A*
`
`Message
`
`Messages Extract Message
`
`Receive Network
`
`
`
`
`
`Identifier
`
` Process Message
`
`
`The communicating processes in a publish-and-subscribe system are not directly connected
`to each other. This enables a subscriber to exist without a publisher and a publisher to exist
`withouta subscriber, When a process subscribing to a messageinitializes, it waits for messages
`Zynga Ex. 1015, p. 13
`Zyngav. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 13
`Zynga v. IGT
`IPR2022-00368
`
`
`
`_
`
`:
`
`460 Chapter 8: Cross-Platform Publish and Subscribe
`
`bearing the identifier to which it has subscribed.If the process publishing such a message does
`not exist, the subscriber does not fail but continues to wait for the message to whichit has
`subscribed. Likewise, if a publishing process has no subscribers, the publisher does not termi-
`nate but publishes the messages, which are sent over the network and discarded.
`In previous systems, communication via TCP socketsfail if the connection with their com-
`municating process is broken or does notexist at the time of data transfer. Transferring data
`via UDP sockets avoidsthe situation of having all communicating entities connected. Because
`the communicating processes are not connected, UDP communication avoids having all com-
`municating processesinitialized and running at the same time. Unfortunately, UDP sockets do
`not provide reliable data transfer. The publish-and-subscribe system eliminates the restriction
`of having all system components running and providesreliable data transfer when both the
`publish-and-subscribe processes are active at the sametime. Providing reliable data transfer is
`discussed in Sections 8.4 and 8.5.
`Removing the restriction that all communicating entities be active provides sey
`advantages.
`¢
`It avoids system failure because of the loss of a communicating entity. In a system that
`communicates via TCP sockets,all clients are connecteddirectly to their server. If the con-
`nection breaks because of a network failure or the loss of the client or server, the entire’
`system fails when the next data transfer action takes place (either sending or receiving),
`This type of system failure is avoided within a publish-and-subscribe system since the pro~
`cesses publishing messages are notdirectly connected to the subscribing processes.
`~
`* Publishing and subscribing processes canbeinitialized at any time throughoutthelife
`of a cross-platform communication system because processes that publish and subs
`do notrely on each other’s existence. This meansthat within a cross-platform commur
`tion system, processes can start up and terminate without fear of harming the system.
`* Multiple publishers and multiple subscribers can coexist. A publish-and-subseribe sys
`enables many processes to publish a message using the same identifier and many proces
`to subscribe to a message. All processes subscribe to a specific message regardless of
`message source. The complexity involved with connecting to all sources of a message i
`eliminated.
`E
`* An unlimited number of messages can be received from a single socket connection.
`message delivered within a publish-and-subscribe system contains a subject or identi
`associated with the message. The subscriber can subscribe to an unlimited number of r
`sage subjects. The subscriber would have to know how to decode each message, but it
`would be able to receive all messages on a single socket connection.
`¢ A publisher can also be a subscriber. A process publishing messages can also subseri
`other messages using the same socket connection. The process can even subscribe
`own published messages.
`
`The Anatomyof a Published Message
`A published message is made of up one or more components. Each componentof the messa
`is created and sent independently, and the entire message is reconstructed on the
`recet
`end. Thefirst componentofall published messages is the subject component. Thesubje
`message identifies the type of message, and all messages bearing a particular subject m
`contain the same structure. The subject component also contains the total number ofba
`Zynga Ex. 1015,
`
`Zynga Ex. 1015, p. 14
`Zynga v. IGT
`IPR2022-00368
`
`
`
`Publish and Subscribe
`461
`components, After decoding the componentsize of the message, the publisher and subscriber
`treate message structures large enough to hold all components of the message and know how
`many components to receive. Each message componentcontains a unique identifier in which
`the identifier signifies the position of the message component within the entire message. This
`identifier can be used by the receiving process to reconstruct the message in its original format
`and to detecterrors in message transmission. Transmission errors are detected by examining
`the identifiers received, If an identifier is missing or out of sequence, a message transmission
`error has occurred. The subject component's identifier is always 0. The structure for the sub-
`ject componentis shownin Figure 8.2.
`The remainder of the message componentsmakes up the body of the message. These com-
`ponents are referred to as body components:Each body componentis independently created
`and added to the complete message. Body components are objects of one type bur can contain
`data of any type andsize. A single body componentobjectis created so thatall Processes in a
`publish-and-subscribe system can receive and send messages regardless of the message com-
`position. The objects that make up the body of the message contain a data member that is a
`large character array used to store data types in their string representation. Character arrays
`are sent over the network in their original form and do not need to be conyerted to a format
`specific to an operating system. The message componentcontainsaflag to indicate the origi-
`nal type of the data stored within the character array, If the originaltypeis a multibyte data
`structure, such asa double or an int, and the message componentis received by a different
`operating system than that from which it originated, the value of the componentis returned
`in its endian form, The operating system data memberused in the subject component deter-
`mines whether the componentwasreceived from a foreign operating system.
`Each message componentalso includes a label, which uniquely names the componentand
`is sent along with its value. The label is a character string and can be used to extract a Ppartic-
`ular element of the message. The advantage ofusing a label to retrieve message elements is
`that the receiving end does not need to know the ordering of body components; it must only
`knowthe names ofthe elements to extract. If the elements of a particular published message
`change, the subscribing process does not need to be altered or recompiled.It will only extract
`the components it requires, ignoring the rest. The ability to continue processing the same
`message bearing a specific subject holds true regardless of whether elements are added or
`deleted or their orderingis changed.
`The final element of a body componentis the component ID number. Each component
`contains a unique ID number. The componentIDs are ordered in the sequence in which they
`are created and are attached to the complete message. The subject of a published message
`contains ID number 0. The componentIDis used in several ways.
`*
`Thevalue of a body componentcan be extracted based onits ID.
`* The subscribing process can determineif any message componentsare missing.
`* The subscribing process can order the message components received in the same order as
`they were originally sent.
`The structure of a message componentis shownin Figure 8.3.
`
`Zynga Ex. 1015, p. 15
`Zyngav. IGT
`IPR2022-00368
`
`Zynga Ex. 1015, p. 15
`Zynga v. IGT
`IPR2022-00368
`
`
`
`462 Chapter8: Cross-Platform Publish and Subscribe —
`Figure 8.2
`The Subject Componentof a Published Message
`
`Subject
`(char*)
`
`Message ID
`Number 0
`(int)
`
`Operating System
`Indicator
`
`Numberof Body
`Components
`(int)
`
`(char)
`(int)
`
`Figure 8.3
`
`The Message Component Structure
`
`ComponentLabel
`(char *)
`
`Original Data Type
`(char)
`
`Message ID
`Number
`
`|J|
`
`How to Create, Publish, and Subscribe to Messages
`When a messageis created, a new message template object is instantiated. The message tem-
`plate object containsall components of the message, including its subject. The message tem-
`p