摘要: 使用标准库函数: htons():将16位整数从主机字节序转换为网络字节序。 htonl():将32位整数从主机字节序转换为网络字节序。 ntohs():将16位整数从网络字节序转换为主机字节序。 ntohl():将32位整数从网络字节序转换为主机字节序。 例子: #include <iostrea 阅读全文
posted @ 2023-07-14 17:22 朴实小码哥 阅读(190) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <Windows.h> #include <WinSock2.h> std::string GetLastErrorMessage() { DWORD errorCode = WSAGetLastError(); LPSTR errorMes 阅读全文
posted @ 2023-07-14 17:20 朴实小码哥 阅读(256) 评论(0) 推荐(0) 编辑