windows网络编程--学习笔记01
2012-10-03 10:39
465 查看
1.Winsock system architecture2. 各种类型的protocol(1)Message-Oriented面向消息的协议特点:保留数据边界,即每一条消息是界限分明的,一条消息一条消息的处理A protocol is said to be message-oriented if for each discrete write command, it transmits only those bytes as a single message on the network. (2)Stream-Oriented面向流的协议把数据当成字节流来处理,忽略消息边界,把几条消息和在一起发送、一起读取A protocol that does not preserve message boundaries is often referred to as a stream-based protocol.Stream service is defined as transmitting data in a continual process; the receiver reads as much data as is available with no respect to message boundaries. (3)Pseudo Stream伪流的协议在发送端是一条一条消息的发,而在接收端可以以流的方式读取。The sender must send each individual packet separately, but the receiver is free to coalesce them in whatever sizes are available.(4)Connection-Oriented and ConnectionlessIn connection-oriented services, a path is established between the two communicating parties before any data is exchanged.A connectionless service is similar to the postal service: the sender addresses a letter to a particular person and puts it in the mail. The sender doesn't know if the recipient is expecting to receive a letter or if severe stormsare preventing the post office from delivering the message. Note that for some connectionless protocols, such as UDP, a Winsock application may call connect with the destination's IP address but this does not imply that any physical connection is established. It is simply a convenient wayto associate a destination address with the socket so that the send and WSASend APIs may be used instead of sendto and WSASendTo. 3.WSAEnumProtocols//列举机器上安装的协议 //returns an array of WSAPROTOCOL_INFO structuresint WSAEnumProtocols (
LPINT lpiProtocols, LPWSAPROTOCOL_INFO lpProtocolBuffer, LPDWORD lpdwBufferLength );The WSAPROTOCOL_INFO structure is defined as
typedef struct _WSAPROTOCOL_INFO { DWORD dwServiceFlags1; DWORD dwServiceFlags2; DWORD dwServiceFlags3; DWORD dwServiceFlags4; DWORD dwProviderFlags; GUID ProviderId; DWORD dwCatalogEntryId; WSAPROTOCOLCHAIN ProtocolChain; int iVersion; int iAddressFamily; int iMaxSockAddr; int iMinSockAddr; int iSocketType; int iProtocol; int iProtocolMaxOffset; int iNetworkByteOrder; int iSecurityScheme; DWORD dwMessageSize; DWORD dwProviderReserved; TCHAR szProtocol[WSAPROTOCOL_LEN + 1]; } WSAPROTOCOL_INFO, FAR * LPWSAPROTOCOL_INFO;5.
SOCKET WSASocket( int af, int type, int protocol, LPWSAPROTOCOL_INFO lpProtocolInfo, GROUP g, DWORD dwFlags);
相关文章推荐
- windows网络编程--学习笔记01
- c#网络编程学习笔记01_委托
- windows网络编程学习笔记一
- Windows网络编程之Select模型学习笔记
- 【网络编程学习笔记01】Socket套接字编程(TCP/IP)
- windows网络编程--学习笔记03
- 网络编程学习笔记--01
- 【深度学习】【caffe实用工具5】笔记27 windows下SSD网络中的get_image_size工具的使用
- 网络编程学习笔记(二)UDP协议及聊天小程序的实现
- 0-Linux 网络编程学习笔记导航
- 学习笔记-基础知识12-网络编程
- <<Python基础教程>>学习笔记 | 第14章 | 网络编程
- Java学习笔记------网络编程
- Java基础学习笔记二十二 网络编程
- C#学习之路,学习笔记 第13章 Windows窗体编程 13.4超链接标签(LinkLabel)
- 发生系统错误 1275.此驱动程序被阻止加载 寒江孤钓<<windows 内核安全编程>> 学习笔记
- 三. 简单绘图--Windows编程课程学习笔记
- Windows核心编程学习笔记-------19章
- [TensorFlow 学习笔记-01]Windows下TensorFlow(Only CPU)安装
- java NIO非阻塞式IO网络编程学习笔记(一)