Introduction

Introduction

Welcome to Network Programming for Microsoft Windows, Second Edition! The second edition covers the same topics as the first edition and even more as well. This book primarily focuses on the Winsock network programming technology. In particular, we've added a chapter on writing high-performance, scalable Winsock applications and a chapter devoted to Winsock programming in the C# programming language using the exciting new .NET Application Frameworks library. In addition, we've completely updated the chapter on the Windows Service Provider Interface (SPI), and we cover additional protocols (such as IPv6 and reliable multicasting) and reveal functionality that is new to Windows XP.

This book covers a wide variety of networking functions available in Windows 95, Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, and Windows CE. The majority of the text covers intermediate and advanced networking topics, but we retooled the Winsock section so that it is more accessible to programmers of all levels.

How to Use This Book

This book covers six technical areas:

  • Winsock application programming interface (API)
  • .NET Sockets (from C#)
  • Visual Basic Winsock Control
  • Client Remote Access Server (RAS)
  • IP Helper API
  • Legacy Networking—NetBIOS and the Windows redirector

The NetBIOS and Windows redirector technologies have not changed since the first edition, and because of space considerations, these chapters are included only with the eBook located on the companion CD-ROM as Chapters 17-22.

In this edition, the majority of the book is dedicated to covering the Winsock API. Chapter 1 starts with an introduction to Winsock and is specifically geared for the beginning Winsock programmer. This chapter covers all the basics and introduces Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) through simple samples, as well as providing a roadmap to advanced Winsock topics covered in other chapters. For the sake of simplicity, Chapter 1 covers the IPv4 protocol.

Chapter 2 discusses the Winsock architecture such as the Winsock catalog, as well as how Winsock fits into the overall network stack. In addition, we cover how to enumerate the Winsock catalog and find characteristics specific to each protocol installed on the system.

Chapter 3 is dedicated to the Internet Protocol (IP). In this chapter we cover both IPv4 and IPv6 and include addressing information and name resolution for each. The last part of this chapter illustrates how to write applications that work seamlessly over either protocol. The remaining protocols accessible from Winsock are covered in Chapter 4. In both chapters, we present simple samples illustrating the basic concepts of each protocol family.

Chapters 5 and 6 cover the input/output (I/O) models Winsock offers for the advanced Winsock programmer. Chapter 5 presents each model and the basics of how to use it, while Chapter 6 goes into detail on how to write high-performance, scalable Winsock applications. In this chapter, we discuss resource management and the merits of the different I/O models as well as performance numbers. Sample code is provided that illustrates each of the I/O models.

Chapter 7 is a reference that covers all the socket options and ioctls that can be accessed from Winsock. These include generic Winsock options as well as protocol-specific ioctls. For each option, we provide the expected input and output parameters necessary for successfully accessing the option. This chapter has been updated to include options specific to new protocols (such as IPv6 and reliable multicasting).

Chapter 8 covers Winsock registration and name resolution and introduces the different name spaces in which queries can be performed, such as Domain Name System (DNS), Service Advertising Protocol (SAP), and the Active Directory directory service. The chapter also discusses the new Network Location Awareness (NLA) namespace, which can provide valuable information about the network you are currently connected to.

Multicasting is the topic of Chapter 9. This chapter covers IPv4 and IPv6 multicasting as well as the reliable multicasting transport new to Windows XP. This chapter also discusses ATM point-to-multipoint communications. Chapter 10 is devoted to Quality of Service (QOS), which is a technology that allows for guaranteeing a portion of the network bandwidth to an application. Chapter 11 moves on to raw IP sockets and discusses how to build your own protocol headers which can be used to communicate directly over IP networks—this includes both IPv4 and IPv6.

Chapter 12 covers the Winsock Service Provider Interface (SPI). This interface is a means by which a programmer can install a layer between Winsock and lower-level service providers such as Transmission Control Protocol/Internet Protocol (TCP/IP) for the purpose of manipulating socket and protocol behavior or name registration and resolution. This is an advanced feature that allows software developers to extend Winsock functionality. The SPI chapter has been completely rewritten and provides fully functioning, robust layered service provider (LSP) sample code.

Chapter 13 covers the .NET Application Framework's Network Socket object. In this chapter, we show how to access the new Socket class from the C# language. Chapter 14 discusses the Microsoft Visual Basic Winsock control. We decided to include this chapter after seeing how many developers rely on Visual Basic and this control. The control is limited in its ability to utilize the advanced features of Winsock, but it is fantastic for Visual Basic developers who require simple, easy-to-use network communication.

Chapter 15 covers the Remote Access Server (RAS) client API. We decided to include a chapter on RAS because of the popularity of the Internet, dial-up communication, and Virtual Private Networking (VPN) communication. The ability for a programmer to add dial-up capability to a network application is quite useful since it makes the program easier for the user. That is, an end user does not need to know how to set up and establish a dial-up connection to use your network application.

Chapter 16 covers the IP Helper API, which provides useful information about the network configuration on the current computer. This includes a new function that enumerates IPv6 specific information.

Finally, chapters on the legacy technologies (NetBIOS, mailslots, named pipes, and Windows Redirector) from the first edition, as well as NetBIOS command and Winsock error code references, are included in eBook form (as Chapters 17-22) on the companion CD-ROM.

We hope that you will find this book to be a valuable learning and reference tool. We still believe it is the most comprehensive book about Windows network programming available.

How to Use the Companion CD-ROM

In each chapter, we present code examples that demonstrate how to use many of the net-working APIs we describe. These examples are available on the accompanying CD-ROM. To install them, place the CD into your drive and Autorun will launch a starting menu. If the starting menu does not launch automatically, it can be accessed by running StartCD.exe in the disc's root directory. The sample code can be installed by selecting the Install Example Code option on the starting menu, or you can access each example from the CD (under Samples\ChapterXX).

note

The CD-ROM requires a computer running a 32-bit Microsoft Windows platform.

About the eBook

The companion CD-ROM also includes an electronic version of the book that you can view using Microsoft Internet Explorer 5.01 or later.

To Use the eBook

  1. Insert the companion CD-ROM into your CD-ROM drive.
  2. On the starting menu that appears, click eBook and follow the instructions, or select Run from the Start menu and type D:\eBook\Autorun.exe (where D is the name of your CD-ROM disk drive). This will install an icon for the eBook on your desktop.
  3. Click OK to exit the Installation Wizard.
  4. You must have the companion CD-ROM inserted in your CD-ROM drive to run the eBook.

Microsoft Press Support Information

Every effort has been made to ensure the accuracy of the contents of this book and the companion CD-ROM. Microsoft Press provides corrections for this book at http://www.microsoft.com/mspress/support/.

Many of the function definitions and tables in this book were adapted or reprinted here with the generous participation and permission of the Microsoft Platform SDK documentation group. Some material is based on preliminary documentation and is subject to change. For the latest Platform SDK information as well as updates and bug fixes, please visit the MSDN Web site at http://www.microsoft.com/msdownload/platformsdk/sdkupdate/.

If you have comments, questions, or ideas regarding this book or its companion CD, please send them to Microsoft Press via e-mail to:

MSPInput@Microsoft.com

or via postal mail to:

Microsoft Press
Attn: Network Programming for Microsoft Windows, Second Edition Editor
One Microsoft Way
Redmond, WA 98052-6399

Please note that product support is not offered through the above address.



Network Programming for Microsoft Windows
Network Programming for Microsoft Windows (Microsoft Professional Series)
ISBN: 0735605602
EAN: 2147483647
Year: 2001
Pages: 172
Authors: Anthony Jones

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net