- 博客(4)
- 收藏
- 关注
原创 利用流套接字(tcp/ip)实现winsock编程(C语言版
基于TCP的通信程序 sever #include<stdio.h> #include <winsock2.h> #include <windows.h> #pragma comment(lib,"WS2_32.lib") int main() { //初始化WSA WORD sockVersion = MAKEWORD(2, 2); WSADATA wsaData; if (WSAStartup(sockVersion, &w
2020-10-23 18:08:46
1402
3
原创 使用gethostname()和gethostbyname()获取主机名和IP地址的功能
gethostname和gethostbyname 通过gethostname和gethostbyname两个函数来实现获取主机名和IP地址的功能。 #include <stdio.h> #include <winsock2.h> #pragma comment(lib,"ws2_32.lib") int main(int argc, char **argv) { char hostname[32]; struct hostent *host; // char* ip;
2020-10-22 23:38:13
3553
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅