狮子座男

导航

随笔分类 -  C

inet_pton和inet_ntop inet_ntoa
摘要:Linux下地址转换函数inet_pton ==> Oxinet_ntop ==> xxx.xxx.xxx #include #include #include 1 char IPdec[20]; //存放点分十进制IP地址 2 3 struct in_addr s; // IPv4地址结构体 4 5 6 7 printf("Please input IP address: "); 8 9 scanf("%s", IPdec); //input 192.168.1.110 11 12 13 inet_pton(AF_INET, ... 阅读全文

posted @ 2013-12-08 21:21 狮子座男 阅读(798) 评论(0) 推荐(0)

Socket 学习笔记 01 常用函数
摘要:常用方法 创建套接字: socket() 绑定本机端口: bind() 建立连接: connect(),accept() 侦听端口: listen() 数据传输: send(), recv() 输入/输出多路复用: select() 关闭套接只: closesocket()1. socket方法 方法头文件 Windows下用 #include 或 #include Unix下用 #include #include int socket(int domain, int type, int protocol); sock = socket(PF_INET, S... 阅读全文

posted @ 2013-12-03 15:31 狮子座男 阅读(283) 评论(0) 推荐(0)