by Bob Quinn and Dave Shute, with foreword by Martin Hall
Addison-Wesley, Reading, MA, ISBN: 0-201-63372-8
Now shipping (late November, 1995)
- What is Windows Sockets?
- What are its Benefits?
- An Open Standard
- Provides Source Code Portability
- Supports Dynamic Linking
- Benefits Summary
- What is its History?
- What is its Future?
- Conclusion
[Go to top]
- The OSI Network Model
- The WinSock Network Model
- Information and Data
- Application Protocols
- OSI layers and WinSock
- Application Layer
- Presentation Layer
- Session Layer
- Transport Layer
- Network Layer
- Data Link Layer
- Physical Layer
- Modular Boxes
- Services & Protocols
- Protocols & APIs
[Go to top]
- What is TCP/IP?
- Transport Services
- Connection-less Services: UDP
- Connection-oriented Services: TCP
- Deciding on a Transport: UDP versus TCP
- Network services
- IP Services
- ICMP Services
- Support Protocols & Services
- Domain Name Service (DNS)
- Address Resolution Protocol (ARP)
- Other Support Protocols
- What's its History?
- What's its Future?
[Go to top]
- Client-Server Model
- Client & Server Association
- Network Program Sketch
- Open a Socket
- Name the Socket
- sockaddr Structure
- sockaddr_in Structure
- Port Numbers
- Local IP Address
- What's in a Socket Name?
- Client Socket Name is Optional
- Associate with Another Socket
- How a Server Prepares for an Association
- How a Client Initiates an Association
- How a Server Completes an Association
- Send and Receive Between Sockets
- Sending Data on a "connected" Socket
- Sending Data on an "unconnected" Socket
- Receiving Data
- Association as Socket Demultiplexer
- Close the Socket
- Client & Server Sketches
- Connection-oriented (TCP) Network Applications
- Connection-less (UDP) Network Applications
- Set the Remote Socket Name Once
- Set the Remote Socket Name Each Datagram
[Go to top]
- What are Operation Modes?
- Wait on Hold: Blocking
- Call Again Later: Non-blocking
- Request a Call Back: Asynchronous
- Blocking
- Blocking Sockets
- Blocking Functions
- Blocking is Fake
- Blocking Hook Functions
- The Blocking Context
- React to WSAEINPROGRESS Gracefully
- Detect with WSAIsBlocking()
- Canceling Blocking Operations
- Maintain Application State
- Canceling Blocking Operations
- Cancellation occurs later
- Further Socket Use is Limited
- Cancellation Occurs Later
- Further Socket Use is Limited
- Cancellation May Fail
- Code Example
- Timeouts on Blocking Operations
- Automatic Timeouts
- User Settable Timeouts
- TCP Keepalive Timeouts
- No Receive Minimum
- Code Example
- Non-Blocking
- How Do You Make a Socket Non-blocking?
- Success and failure are not absolutes!
- WSAEWOULDBLOCK Error
- Partial success
- Polling Instead of Blocking
- Explicit Yielding
- Code Example
- Asynchronous
- What Are the Asynchronous Functions?
- WSAAsyncGetXByY()
- Code Example
- AU_Time Application
- Performance Differences
- Platform Differences
- Blocking is Real
- Threaded Applications
- Other Things Hold True
[Go to top]
- What are the Socket States?
- Datagram Socket States
- Stream Socket States
- What are the Methods of Detection?
- Function Call Success or Failure
- Synchronous Detection
- Asynchronous Detection
- WSAAsyncSelect()
- How Does WSAAsyncSelect() Work?
- What are the Asynchronous Events?
- Avoid Windows of Misopportunity
- What are the Re-enabling Functions?
- What's in a Notification Message?
- Be Prepared for Failure
- Looping in Response
- Canceling Asynchronous Notification
- Event Descriptions
- FD_ACCEPT Event
- FD_CLOSE Event
- FD_CONNECT Event
- FD_OOB Event
- FD_READ Event
- FD_WRITE Event
- AS_ECHO Application
- select()
- How Do You Use select()?
- FD_CLR (socket, *fd_set)
- FD_ISSET (socket, *fd_set)
- FD_SET (socket, *fd_set)
- FD_ZERO (*fd_set)
- select() Input Parameters
- readfds
- writefds
- exceptfds
- timeval Structure
- Don't Use select() as a Timer
- Beware Timeout of Zero
- Code Example
- Peeking at Data
- ioctlsocket() FIONREAD Command
- recv() with MSG_PEEK Flag
- Out-of-band Data
- TCP Limitations
- ioctlsocket() SIOCATMARK Command
- The Listening State
[Go to top]
- Sample FTP Client
- File Transfer Protocol Overview
- Control Connection
- Data Connection
- FTP Commands
- FTP Replies
- FTP Finite State Machine
- AC_FTP Application
- AC_FTP in Operation
- Sample Library
- CenterWnd()
- CloseConn()
- CreateLclFile()
- Dlg_About()
- GetAddr()
- GetBuf()
- GetHostID()
- GetLclDir()
- GetPort()
- WSAErrStr()
- WSAperror()
- WinSockx.h
- Globals.c
- WSA_Xtra.h
[Go to top]
- Host Name and Address Resolution
- hostent Structure
- Host Name Resolution
- gethostbyname()
- WSAAsyncGetHostByName()
- Upon Completion
- Sketch of Function Operation
- Code Example
- Address Resolution
- gethostbyaddr()
- WSAAsyncGetHostByAddr()
- Host Table, DNS & NIS
- Host Table
- Domain Name System (DNS)
- Network Information Service (NIS)
- Local Host Information
- Addresses and Formatting
- in_addr structure
- Address References
- Address Class
- Common Addresses
- inet_addr()
- inet_ntoa()
- Protocol and Address Families
[Go to top]
- Socket Control
- FIONBIO
- FIONREAD
- SIOCATMARK
- Other Control Commands
- Socket Options
- getsockopt() and setsockopt()
- Code Examples
- setsockopt() with Boolean Option
- getsockopt() with Integer Option
- setsockopt() with struct linger Option
- SO_ACCEPTCONN
- SO_BROADCAST
- What's a Broadcast Address?
- Multicast Addresses
- Proper use of Broadcasts
- SO_DEBUG
- SO_DONTLINGER
- SO_DONTROUTE
- SO_ERROR
- SO_KEEPALIVE
- How Do Keepalives Work?
- How Often are Keepalives Sent?
- Implement Your Own Keepalive
- SO_LINGER
- Avoiding Ambiguities
- Do You Need SO_LINGER?
- linger Structure
- Code Example
- SO_OOBINLINE
- SO_RCVBUF and SO_SNDBUF
- SO_REUSEADDR
- SO_TYPE
- TCP_NODELAY
- What's the Nagle Algorithm?
- What Applications Need TCP_NODELAY?
- Unsupported Options
- Future Options
- Blocking Hooks
- WSASetBlockingHook()
- WSAUnhookBlockingHook()
- Blocking Hook Functions
- Socket Names
- getsockname()
- getpeername()
- Blocking Status
[Go to top]
- Startup and Cleanup
- WSAStartup()
- When and Where?
- WSAStartup() Error Messages
- WSAData structure
- Version Negotiation
- Code Example
- WSACleanup()
- Byte Ordering
- Byte Ordering Functions
- htons()
- ntohs()
- ntohl()
- htonl()
- Code Example
- Service Names and Ports
- servent Structure
- Service Resolution
- getservbyname()
- WSAAsyncGetServByName()
- Upon Completion
- Code Example
- Port Resolution
- getservbyport()
- WSAAsyncGetServByPort()
- Services Database
- Protocol Names and Numbers
- protoent Structure
- Protocol Name Resolution
- getprotobyname()
- WSAAsyncGetProtoByName()
- Protocol Number Resolution
- getprotobynumber()
- WSAAsyncGetProtoByNumber()
- Protocols Database
- Error Reporting
- WSAGetLastError()
- WSASetLastError()
- Error Text Display
[Go to top]
- Creating a New API
- Emulated API
- Application Protocol API
- Encapsulated WinSock API
- DLL Issues
- Reentrancy
- Setting a Blocking Hook
- Task Management
- Registering the Application Process
- Registering a Helper Process
- Loading the WinSock DLL Explicitly
- Sample DLL
- WSASimpl Application
- WSASimpl DLL
[Go to top]
- Differences to Consider
- Sockets are not File Handles
- Cannot dup() a Socket
- close() and ioctl() Functions are Renamed
- read(), write() or fcntl() Functions Unavailable
- Some ioctlsocket() FIO Command Unavailable
- select()'s fd_sets are Opaque
- select() Doesn't Act as a Timer
- signal() Unavailable
- Domain Name Unavailable
- Address Info and Manipulation Unavailable
- syslog() Unavailable
- errno Variable Unavailable
- perror() and strerror() Unavailable
- Database File Manipulation Unavailable
- bcmp(), bcopy() and bzero() Unavailable
- Local IPC Unavailable
- OOB API Differs
- setsockopt() SO_DEBUG optional
- 16-bit Windows Considerations
- 16-bit Windows Doesn't Clean House
- 16-bit Windows is Non-preemptive
- 16-bit Windows File System isn't Secure
- 16-bit Windows Uses Segmented Addressing
- fork() Unavailable
- Incidentals
- Include Files
- Socket Domains
- Socket Types
- Socket Handles
- Error Values
- Functions List
[Go to top]
- Problem Types
- Installation Problem
- Network Problem
- Application Problem
- WinSock DLL Problem
- What failed, and how?
- Problem Qualification
- Installation Debugging
- Network Debugging
- Generic Network Debugging
- Host Resolution Debugging
- Application Debugging
- Debugging Tools
- Network Debugging Utilities
- ping
- traceroute
- nslookup
- Standard UNIX Tools
- SNMP Tools
- Ad hoc Tools
- Network Analyzers
- Application Debugging Utilities
- WinScope
- X-Ray Winsock
- Create Your Own WinSock Watcher
- WinSock Compliance & Performance Utilities
- wsatest
- Windows Sockets API Tester (WSAT)
- Socket Wrencher
- Other Application Debugging Tools
[Go to top]
- Characterizing Your Application
- Application Data Flow
- Use Big Buffers
- Think MTU
- Consider the Maxim
- Send Moderate Amounts
- Receive Large Amounts
- Don't Peek
- Receive Before You Send
- Stream Algorithms
- Sending Structured Data
- Sending Interactive Data
- Detecting a Dead Connection
- Verifying Data Delivery
- Datagram Algorithms
- Implementing a Timeout
- Sequencing Datagrams
- Throttling Sends
- Synchronizing Sender and Receiver
- Good News Code
- Check Returns
- Check for Partial Success
- Expect Any Error at Any Time
- Check for Non-Fatal Errors
- Handle Errors Gracefully
- Leave an Out
- Don't Ignore Warnings
- Common Traps and Pitfalls
- Opening and Naming a Socket
- Connecting
- Listening and Receiving
- Closing a Socket
- Using Host Names and Addresses
- Using WSAAsyncSelect()
- Using Blocking Sockets
- Exiting an Application
- Miscellaneous
[Go to top]
- The WOSA Network Model
- 32-bit WinSock
- Windows 95
- Cross-Execution
- 32-bit WinSock Features
- New Socket Options
- SO_OPENTYPE
- SO_RCVTIMEO and SO_SNDTIMEO
- Service Features
- Other Protocol Suites
- 32-bit operating system advantages
- Blocking is Real!
- Threading
- Sockets are File Handles
- Console Interface
- Other platforms
[Go to top]
- Optional Standard is an Oxymoron
- Should You use Optional Features?
- SOCK_RAW
- ICMP Ping Application
- Traceroute
- Code Example
- Multicast
- Why Use Multicast?
- Multicast API
- IP_ADD_MEMBERSHIP
- IP_DROP_MEMBERSHIP
- IP_MULTICAST_IF
- IP_MULTICAST_LOOP
- IP_MULTICAST_TTL
- Multicast Mechanics
- Code Example
- Loopback
- Sharing Sockets
- Is Socket Sharing Possible?
- Optional Options
- Sockets as File Handles
- Expect Any Error Anywhere
- Other Optional Features
[Go to top]
- Do You Need WinSock 2?
- Overview of Features
- Multiple Protocol Support
- WinSock 2 Architecture
- Protocol independence
- Namespace Independence
- Globally Unique Identifiers
- Generic Address Formatting
- Parametric Service Searches
- Service Installation and Registration
- 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
- WSAIoctl()
- get/setsockopt()
[Go to top]
- Layering within TCP/IP Packets
- ARP Header
- IP Header
- ICMP Header
- IGMP Header
- UDP Header
- TCP Header
- Sample Dialogs
- Server on Same Subnet
- Server on Different Subnet
[Go to top]
- Structures
- Functions
- Macros
[Go to top]
- Where to Get Error Values
- Where Errors Came From
- What Errors to Expect
- User-Fixable Errors
- Detailed Error Descriptions
- Error-less Functions
- Function-less Errors
- Error Description List
- Errors in Numerical Order
[Go to top]
- Essential Files
- Compile & Link Mechanics
- Using Different WinSocks
- Using Different Languages
[Go to top]
- Internet Sources
- URLs and URIs
- FTP sites
- List Servers
- Mail lists
- Newsgroups
- Web Pages
- Bibliography
[Go to top]