win32 network programming - gbv

5
Win32 Network Programming Windows® 95 and Windows NT Network Programming Using MFC Ralph Davis TT Addison-Wesley Developers Press Reading, Massachusetts • Menlo Park, California • New York Don Mills, Ontario • Harlow, England • Amsterdam Bonn • Sydney • Singapore • Tokyo • Madrid • San Juan Paris • Seoul • Milan • Mexico City • Taipei

Upload: others

Post on 02-Nov-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Win32 Network Programming - GBV

Win32 Network Programming

Windows® 95 and Windows NT Network Programming Using MFC

Ralph Davis

• T T

Addison-Wesley Developers Press Reading, Massachusetts • Menlo Park, California • New York Don Mills, Ontario • Harlow, England • Amsterdam Bonn • Sydney • Singapore • Tokyo • Madrid • San Juan Paris • Seoul • Milan • Mexico City • Taipei

Page 2: Win32 Network Programming - GBV

Contents

Acknowledgments

Chapter 1 Introduction Installing the Disk Using the Code Problems, Assistance, and Upgrades

Chapter 2 Exception Handling Win32 Exception Handling C++ Exception Handling Combining Win32 and C++ Exception Handling Conclusion Suggested Readings

Chapter 3 Win32 Memory Allocation States of Memory The Virtual Memory API Heap Memory Allocation A Little PWALK through Memory C++ and MFC Considerations Conclusion Suggested Readings

Chapter 4 Multithreading What are Threads? Multithreaded Application Architectures CreateThread() The Thread Entry-Point Function _beg i nth read ()/_begi nth readex() AfxBeginThreadQ and the CWinThread Class

IX

1 6 6 7

9 9 22 23 29 30

31 32 33 39 43 55 60 61

63 63 66 67 69 70 72

Page 3: Win32 Network Programming - GBV

vi Contents

Which API Should You Use? Killing Threads Thread Synchronization Code Listings Conclusion Suggested Readings

Chapter 5 Synchronization Objects The Wait Functions The Mechanics of the API Code Listing C++ and MFC Considerations Using the MFC Synchronization Object Classes Conclusion Suggested Readings

Chapter 6 Win32 File I/O Basic File I/O Operations Overlapped I/O Using Overlapped I/O—The cat Utility Additional Win32 File I/O Functions C++ and MFC Considerations Additional Source Code Listings Conclusion Suggested Readings

Chapter 7 Dynamic-Link Libraries in Windows NT and Windows 95 The Two Kinds of Dynamic-Link Libraries Building the Two Kinds of DLLs The DLL Entry Point Exporting Symbols from a DLL Data in a DLL Thread-Specific Data Memory-Mapped File I/O C++ and MFC Considerations Conclusion Suggested Readings

Chapter 8 Peer-to-Peer Concepts and API Design Peer-to-Peer Communications Types of Peer-to-Peer Service

75 75 77 78 83 84

87

88 91 96 98 105 107 107

109

110 114 129 141 142 167 184 185

187

187 188 189 190 191 192 195 199 224 224

227

227 228

Page 4: Win32 Network Programming - GBV

Contents vii

Developing a Standardized API Conclusion Suggested Readings

Chapter 9 Windows Sockets Programming Interfaces for TCP/IP Berkeley Sockets to Windows Sockets Basic Windows Sockets Windows Sockets Extensions MFC Support for Windows Sockets Extensions to the MFC Sockets Classes The Service Registration API The WNet DLLs Using the Service Registration API Conclusion Suggested Readings

Chapter 10 Named Pipes and Mailslots Named Pipes API—The Server Side Named Pipes API—The Client Side Named Pipes API—Data Exchange Other Client-Side Functions Terminating a Named Pipes Connection Strategies for Multithreading a Named Pipes Server Mailslots C++ and MFC Considerations Class Implementation Specifics Code Listings Conclusion Suggested Readings

Chapter 11 Remote Procedure Calls and Win32 Services RPC as a Vehicle for Exporting an API Microsoft RPC Compliance with OSF/DCE Structure of RPC OLE 2 Custom Interfaces Win32 Services Additional Code Listing Conclusion Suggested Readings

Chapter 12 The LAN Manager API for Windows NT Why Use the LAN Manager API?

230 235 236

237

237 239 240 260 271 281 301 354 379 379

381

381 387 388 388 390 390 393 395 406 418 436 436

437

438 439 440 489 493 520 531 532

533

533

Page 5: Win32 Network Programming - GBV

viii Contents

General Considerations Finding Out about Servers Managing Users Managing Groups Associating Users and Groups Conclusion Suggested Readings

Chapter 13 The Win32 Security API The Windows NT Security Model Using the Win32 Security Functions System Access Control Lists C++ and MFC Considerations Conclusion Suggested Readings

Chapter 14 The Registry and Performance Monitoring The Registry as a Hierarchical Database The Win32 Registry API Using the Registry Performance Monitoring GetPerformanceCounterData() Conclusion Suggested Readings

Chapter 15 Additional Network APIs The Build-in WNet Functions NetDDE The Messaging API (MAPI) Conclusion Suggested Readings

Chapter 16 Sample Applications The Windows Network Manager Win32 Benchmark Tests Conclusion

540 544 553 560 566 590 591

593

593 601 633 638 662 662

665

666 667 675 683 695 704 705

707

707 717 725 736 736

737

737 750 798

Index 801