再谈Winsock网络编程入门计算机等级考试
文章作者 100test 发表时间 2010:01:04 18:00:11
来源 100Test.Com百考试题网
虽然自己接触网络编程已经很多年,但初学者还是需要入门的,这里谈谈我的在编写Windows网络应用程序的时候,最常用的便是Winsock接口,注意它不是网络协议,你可以理解它为网络应用API。
Winsock简介
Windows下网络编程的规范-Windows Sockets是Windows下得到广泛应用的、开放的、支持多种协议的网络编程接口。从1991年的1.0版到1995年的2.0.8版,经过不断完善并在Intel、Microsoft、Sun、SGI、Informix、Novell等公司的全力支持下,已成为Windows网络编程的事实上的标准。
实际上Windows95以后的各个windows版本都支持Winsock2.2版本,但是Window CE 只支持1.1版本。Winsock2.2提供了更多的功能和API函数,而且区分两个版本的函数非常容易,2.2版本的API函数都以WSA开头的,除了 WSAStartup, WSACleanup, WSARecvEx, 和 WSAGetLastError这几个函数也出现在1.1版本中。
微软Winsock 2官方介绍:
Windows Sockets 2 (Winsock) enables programmers to create advanced Internet, intranet, and other network-capable applications to transmit application data across the wire, independent of the network protocol being used. With Winsock, programmers are provided access to advanced Microsoft? Windows? networking capabilities such as multicast and Quality of Service (QOS).
Winsock follows the Windows Open System Architecture (WOSA) model. it defines a standard service provider interface (SPI) between the application programming interface (API), with its exported functions and the protocol stacks. It uses the sockets paradigm that was first popularized by Berkeley Software Distribution (BSD) UNIX. It was later adapted for Windows in Windows Sockets 1.1, with which Windows Sockets 2 applications are backward compatible. Winsock programming previously centered around TCP/IP. Some programming practices that worked with TCP/IP do not work with every protocol. As a result, the Windows Sockets 2 API adds functions where necessary to handle several protocols.
Developer Audience
Windows Sockets 2 is designed for use by C/C programmers. Familiarity with Windows networking is required.
Run-Time Requirements
Windows Sockets 2 can be used on all Windows platforms. Where certain implementations or capabilities of Windows Sockets 2 platform restrictions do exist, they are clearly noted in the documentation.
In This Section
Topic Description
What s New for Windows Sockets
Information on new features for Windows Sockets.
Network Protocol Support in Windows
Information on network protocol support for Windows Sockets on different versions of Windows.
About Winsock
General information on Windows Sockets programming considerations, architecture, and capabilities available to developers.
Using Winsock
Procedures and programming techniques used with Windows Sockets. This section includes basic Winsock programming techniques, such as Getting Started With Winsock, as well as advanced techniques useful for experienced Winsock developers.
Winsock Reference
Documentation of the Windows Sockets API.