Windows Sockets Network Programming (paperback) / Edition 1

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $50.79
Usually ships in 1-2 business days
(Save 21%)
Other sellers (Paperback)
  • All (3) from $50.79   
  • New (3) from $50.79   

Overview

Windows Sockets (WinSock), a standard network API co-developed by PC network industry leaders including Microsoft, Novell, Hewlett-Packard, and FTP Software, is an extraordinary resource for Windows network programmers. This book will enable you to reap WinSock's full benefits to create client and server network applications for use on any TCP/IP network, including the Internet. It also lays the groundwork for WinSock application development using other protocol suites.

The book describes how to develop 16- and 32-bit WinSock applications, and focuses on designs that will run on any WinSock implementation. It highlights the differences that exist between WinSock DLLs, and other traps and pitfalls in network application development, and shows you how to avoid them. It covers every function in version 1.1 of the WinSock specification, and provides a detailed tour of the newest features in WinSock version 2.

Windows Sockets Network Programming is geared for novice and experienced network programmers alike. The early chapters provide a tutorial that brings novices up to speed quickly, and the remainder provides a detailed reference, with examples. These include complete source code for a number of useful applications, including an ftp client. Other topics covered include: how to create a dynamic link library to run over WinSock, how to port existing BSD Sockets source code to WinSock, and how/when to use WinSock's optional features. It also details debugging techniques and tools.

The appendices provide a quick reference for API essentials, illustrations of the TCP/IP protocol suite, an extensive error reference, and pointers to more information on or off the Internet. The accompanying disk contains the source code for all the sample applications, as well as a few other tools to help you with your programming tasks.

A growing number of the 90,000 network programmers who bought Rich Stevens' UNIX Network Programming need to address a topic not covered by this classic--how to deal with Windows Sockets, also known as WinSock. This book is the defintive word on WinSock, offering a complete tutorial on how to work with Windows Sockets and sample code, which will be available on the Internet.

Read More Show Less

Editorial Reviews

Booknews
A book/disk package describing how to use WinSock to create client and server network applications for use on any TCP/IP network. Describes how to develop 16- and 32-bit WinSock applications, highlights the differences between WinSock DLLs, and provides a detailed tour of the newest features of WinSock version 2. The first half of the book is a tutorial for novice programmers, while the rest offers examples and source code for various applications. The disk contains source code and programming tools. For beginning and experienced programmers. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780768682328
  • Publisher: Addison-Wesley
  • Publication date: 7/19/2011
  • Edition number: 1
  • Pages: 656
  • Product dimensions: 7.30 (w) x 9.20 (h) x 1.50 (d)

Meet the Author

Bob Quinn, currently with FTP Software, was a significant contributor to the version 1.1 specification, and co-administrator of the clarification group for WinSock version 2. He has been developing TCP/IP networks for more than five years, and was primarily responsible for the development of FTP Software's WinSock DLL.

Dave Shute, now an independent consultant, worked for FTP when Windows Sockets first appeared on the market, originally as a technical writer and eventually as the director of marketing.

Read More Show Less

Read an Excerpt

PREFACE: This book describes the Windows Sockets application programming interface (API), commonly known as "WinSock." This is intended to be a companion to the v1.1 Windows Sockets specification, not a replacement for it. The contents provide a roadmap for the specification, an orientation resource. The book describes and illustrates every aspect of the Windows Sockets specification, from top to bottom. It deals with optional features as well as many features in version 2.0 of the Windows Sockets specification.

The key focus of the text is to provide a "how to" guide for writing supportable and extensible network applications that will run efficiently over all Windows Sockets implementations. One of the most frustrating things to hear is, "It's impossible to write anything more than a basic 'hello world' that will execute over all Winsock implementations." This simply is not true. More often than not, when an application runs on one WinSock and fails on another, it is because the application developers made some incorrect assumptions. They assumed that WinSock could do something that the specification did not explicitly warrant. In other words, it may not have been the fault of the WinSock implementor, nor of the WinSock specification. You can avoid this type of application failure, and we show you how.

This book is for anyone who wants to know how to write a successful WinSock application. If you are writing a program from scratch, porting an existing one from Berkeley sockets (or any other network API), writing a network DLL, or just updating an application that someone else wrote, then this book is for you. We deal with both 16-bit Windows platforms (Microsoft Windows 3.1and Windows for Workgroups) and 32-bit platforms (Windows NT 3.1 and 3.5, and Windows 95). We also describe the other platforms that support the WinSock API: Platforms with Windows are adding Sockets.

Organization

The first half of the book contains a tutorial for network programming. We do not make any assumptions about what you already know. The second half is intended to be an in-depth reference, with detailed explanations and code examples. The appendices provide a quick reference.

After we describe Windows Sockets in general terms in Chapter 1, we provide an overview of network software architectures in Chapter 2. In Chapter 3 we describe the protocols in the TCP/IP suite, with a focus on the services available to your network applications, and some of their pros and cons. We begin to provide some details about the WinSock programming interface in Chapter 4, as we describe the framework for all network applications in terms of the fundamental network function calls. Chapter 5 covers the different operation modes available, and Chapter 6 discusses the state machine implicit in every network application. That essentially ends the tutorial.

In Chapter 7 we present the source code for our largest application, an FTP client. Chapters 8, 9, and 10 are a catalog of detailed descriptions of all the WinSock function calls we have not discussed up to this point. Chapter 11 deals with the specifics of creating a dynamic link library to run over a WinSock DLL. Chapter 12 describes the issues and strategies involved with porting existing BSD Sockets source code to 16-bit and/or 32-bit Windows.

We start to wrap things up and tie up loose ends in Chapter 13, which details WinSock application debugging techniques and tools. Chapter 14 provides general advice and many specifics about traps and pitfalls to avoid in your WinSock applications. Chapter 15 describes the many different operating-system platforms that currently provide the WinSock API. Chapter 16 covers the optional features - some intentional, and some not - in the WinSock specification and tells you when and how to use them. Finally, Chapter 17 provides a detailed tour of all the new features in version 2.0 of the WinSock specification.

In Appendix A, we have illustrations and short descriptions of the headers for protocols in the Internet suite (TCP/IP). Appendix B contains a quick reference for the entire WinSock API, including its functions, structures, and macros (including some that were forgotten). Appendix C provides a detailed WinSock error reference. Appendix D contains some mechanical details for compiling and linking applications, and Appendix E has network and bibliographical information sources.

Audience

Although we do not assume any prior knowledge of networks, protocols, or network programming with sockets or any other network API, it does not hurt to have some. This book is for novice and experienced network application developers alike. This text also includes extensive background and illustrative information not found in the v1.1 Windows Sockets specification, so even the most advanced WinSock application developer can benefit from reading it.

We do assume a knowledge of the C programming language and Microsoft Windows APIs (WinAPI or Win32).

Sample Applications

The sample applications in this book were created with Microsoft C version 1.51 (16-bit) and Microsoft C version 2.0 (32-bit). They are also compatible with Borland C version 4.0. Makefiles that support these platforms accompany the source code. The applications have been tested on almost all of the commercial and shareware versions of WinSock available, over Ethernet and PPP (point-to-point protocol), using both local and distant connections. If you find any problems with these applications, we'd like to hear about them. Please e-mail problem reports to bugs@sockets.com.

You can retrieve updates to these sample applications via the Internet: ...

Read More Show Less

Table of Contents

Foreword.

Preface.

1. Introduction to Windows Sockets.

What is Windows Sockets?

What is its History?

What Are its Benefits?

What is its Future?

Conclusion.

2. Windows Sockets Concepts.

The OSI Network Model.

The WinSock Network Model.

OSI Layers in WinSock.

Modular Boxes.

Services and Protocols.

Protocols and APIs.

3. TCP/IP Protocol Services.

What is TCP/IP?

What is its History?

Transport Services.

Network Services.

Support Protocols and Services.

What is its Future?

4. Network Application Mechanics.

Client-Server Model.

Network Program Sketch.

Open a Socket.

Name the Socket.

Associate with Another Socket.

Send and Receive between Sockets.

Close the Socket.

Client and Server Sketches.

5. Operation Modes.

What Are Operation Modes?

Blocking Mode.

Nonblocking Mode.

Asynchronous Mode.

Performance Differences.

Platform Differences.

Blocking is Real.

6. Socket States.

What Are the Socket States?

What Are the Methods of Detection?

WSAAsyncSelect ().

Select ().

Peeking at Data.

Out-of-Band Data.

The Listening State.

7. Sample Application and Library.

Sample FTP Client.

Sample Library.

WinSockx.h.

8. Host Names and Addresses.

Hostname and Address Resolution.

Host Table, DNS, and NIS.

Local Host Information.

Addresses and Formatting.

Protocol and Address Families.

9. Socket Information and Control.

Socket Control.

Socket Options.

Blocking Hooks.

Socket Names.

10. Support Routines.

Startup and Cleanup.

Byte Ordering.

Service Names and Ports.

Protocol Names and Numbers.

Error Reporting.

11. DLLs over WinSock.

Creating a New API.

DLL Issues.

Sample DLL.

12. Porting from BSD Sockets.

Differences to Consider.

Sixteen-bit Windows Considerations.

Incidentals.

Functions List.

13. Debugging.

Problem Types.

What Failed, and How Did It Fail?

Problem Qualification.

Installation Debugging.

Network Debugging.

Application Debugging.

Debugging Tools.

14. Dos and Don'ts.

Characterizing Your Application.

Application Data Flow.

Stream Algorithms.

Datagram Algorithms.

Good-News Code.

Common Traps and Pitfalls.

15. Platforms.

The WOSA Network Model.

Thirty-two-bit WinSock.

Other Platforms.

16. Optional Features.

Optional Standard is an Oxymoron.

Should You Use Optional Features?

Raw Sockets.

Multicast.

Loopback.

Sharing Sockets.

Optional Options.

Sockets as File Handles.

Expect Any Error Anywhere.

Other Optional Features.

17. WinSock 2.

Do You Need WinSock 2?

Overview of Features.

Multiple Protocol Support.

Overlapped I/O.

Scatter and Gather.

Quality of Service.

Socket Groups.

Multipoint and Multicast.

Conditional Acceptance.

Connect and Disconnect Data.

Socket Sharing.

Protocol-Specific Additions.

Appendix A. TCP/IP Protocol Headers.

Layering within TCP/IP Packets.

ARP Header.

IP Header.

ICMP Header.

IGMP Header.

TCP Header.

UDP Header.

Sample Dialogs.

Appendix B. Quick Reference.

Structures.

Functions.

Macros.

Appendix C. Error Reference.

Where to Get Error Values.

What Errors to Expect.

User-fixable Errors.

Detailed Error Descriptions.

Errors in Numerical Order.

Appendix D. What You Need.

Essential Files.

Compile and Link Mechanics.

Using Different WinSocks.

Using Different Languages.

Appendix E. Information Sources.

Internet Sources.

Bibliography.

Index

Read More Show Less

Preface

This book describes the Windows Sockets application programming interface (API), commonly known as "WinSock." This is intended to be a companion to the v1.1 Windows Sockets specification, not a replacement for it. The contents provide a roadmap for the specification, an orientation resource. The book describes and illustrates every aspect of the Windows Sockets specification, from top to bottom. It deals with optional features as well as many features in version 2.0 of the Windows Sockets specification.

The key focus of the text is to provide a "how to" guide for writing supportable and extensible network applications that will run efficiently over all Windows Sockets implementations. One of the most frustrating things to hear is, "It's impossible to write anything more than a basic 'hello world' that will execute over all Winsock implementations." This simply is not true. More often than not, when an application runs on one WinSock and fails on another, it is because the application developers made some incorrect assumptions. They assumed that WinSock could do something that the specification did not explicitly warrant. In other words, it may not have been the fault of the WinSock implementor, nor of the WinSock specification. You can avoid this type of application failure, and we show you how.

This book is for anyone who wants to know how to write a successful WinSock application. If you are writing a program from scratch, porting an existing one from Berkeley sockets (or any other network API), writing a network DLL, or just updating an application that someone else wrote, then this book is for you. We deal with both 16-bit Windows platforms (Microsoft Windows 3.1 and Windowsfor Workgroups) and 32-bit platforms (Windows NT 3.1 and 3.5, and Windows 95). We also describe the other platforms that support the WinSock API: Platforms with Windows are adding Sockets.

Organization

The first half of the book contains a tutorial for network programming. We do not make any assumptions about what you already know. The second half is intended to be an in-depth reference, with detailed explanations and code examples. The appendices provide a quick reference.

After we describe Windows Sockets in general terms in Chapter 1, we provide an overview of network software architectures in Chapter 2. In Chapter 3 we describe the protocols in the TCP/IP suite, with a focus on the services available to your network applications, and some of their pros and cons. We begin to provide some details about the WinSock programming interface in Chapter 4, as we describe the framework for all network applications in terms of the fundamental network function calls. Chapter 5 covers the different operation modes available, and Chapter 6 discusses the state machine implicit in every network application. That essentially ends the tutorial.

In Chapter 7 we present the source code for our largest application, an FTP client. Chapters 8, 9, and 10 are a catalog of detailed descriptions of all the WinSock function calls we have not discussed up to this point. Chapter 11 deals with the specifics of creating a dynamic link library to run over a WinSock DLL. Chapter 12 describes the issues and strategies involved with porting existing BSD Sockets source code to 16-bit and/or 32-bit Windows.

We start to wrap things up and tie up loose ends in Chapter 13, which details WinSock application debugging techniques and tools. Chapter 14 provides general advice and many specifics about traps and pitfalls to avoid in your WinSock applications. Chapter 15 describes the many different operating-system platforms that currently provide the WinSock API. Chapter 16 covers the optional features - some intentional, and some not - in the WinSock specification and tells you when and how to use them. Finally, Chapter 17 provides a detailed tour of all the new features in version 2.0 of the WinSock specification.

In Appendix A, we have illustrations and short descriptions of the headers for protocols in the Internet suite (TCP/IP). Appendix B contains a quick reference for the entire WinSock API, including its functions, structures, and macros (including some that were forgotten). Appendix C provides a detailed WinSock error reference. Appendix D contains some mechanical details for compiling and linking applications, and Appendix E has network and bibliographical information sources.

Audience

Although we do not assume any prior knowledge of networks, protocols, or network programming with sockets or any other network API, it does not hurt to have some. This book is for novice and experienced network application developers alike. This text also includes extensive background and illustrative information not found in the v1.1 Windows Sockets specification, so even the most advanced WinSock application developer can benefit from reading it.

We do assume a knowledge of the C programming language and Microsoft Windows APIs (WinAPI or Win32).

Sample Applications

The sample applications in this book were created with Microsoft C version 1.51 (16-bit) and Microsoft C version 2.0 (32-bit). They are also compatible with Borland C version 4.0. Makefiles that support these platforms accompany the source code. The applications have been tested on almost all of the commercial and shareware versions of WinSock available, over Ethernet and PPP (point-to-point protocol), using both local and distant connections. If you find any problems with these applications, we'd like to hear about them. Please e-mail problem reports to bugs@sockets.com.

You can retrieve updates to these sample applications via the Internet: http://www.sockets.com.

Acknowledgments

Many thanks to people for their help and participation in making this book possible. Thanks especially to the reader, who is the very reason for this book. May your Windows Sockets applications be great ones.

Thanks most of all to Bob Quinn. He wanted to give birth to this book; I only provided the hot water, towels, antiseptic, blankets, silver nitrate, topical anesthesia, and appropriate words.

Dave Shute
dks@world.std.com
Reading, MA
May 1995

There are far too many people that have helped in this endeavor for any acknowledgment list to do justice. Nonetheless, I want to mention a few people in particular. First and foremost, for their implicit contribution, is my family. It will be nice to spend time with them again. Second is my cowriter and friend, Dave Shute, whose red pencil is as pricelessly sharp as his wit.

I'm indebted to Larry Backman, Mike Khalandovsky, and John Keller at FTP Software, Inc., for their support and encouragement. Dave Barnard, Kerry Hannigan, and Helen Sylvester - FTP Software's crack SDK support staff - deserve a special note for their constant stream of challenges that did more to teach me about how to program - and how not to program - WinSock apps than anything else did.

My coadministrators in the WinSock 2.0 specification clarification functionality group, Paul Brooks and Vikas Garg, deserve a lot of credit for their untiring efforts to shed light into the dark corners of WinSock. In addition to clarifying many things in the spec, they also clarified some things in this book.

Other reviewers of note: Jim DeMarco, Fred Whiteside, Dave Andersen, Charlie Tai, Alun Jones, Eli Patashnik, and our consulting editor, Alan Feuer.

Thanks to the kind folks at Addison-Wesley: John Wait, Mike Hendrickson, Kim Dawley, Marty Rabinowitz, Simone Payment, and Katie Duffy.

Lastly, I want to thank Martin Hall for having initiated the Windows Sockets effort and his coauthors and contributors for helping him carry it through. The sure sign of a good idea is one that makes you think, "Why didn't I think of that!?" That's WinSock. It was a great idea, and its immediate success has confirmed this obvious fact.

Bob Quinn
rcq@ftp.com.
Weston, Massachusetts
May 1995



Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted March 22, 2001

    The bible on Windows Network Programming

    Some of it is a bit dated (bunch of references to 16 bit Windows, for example), but all in all, a good resource from top to bottom for not only Windows Network programming, but a very good book overall on networking, TCP/IP, Multicasting, etc. Read it from cover to cover and you'll have a great foundation for low level network programming. I used this book to help develop a videoconferencing application. All networking information I needed was in its pages.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)