导航

socket字符串,数值处理函数

inet_pton

字符串转为网络字节序整数,网络字节序可以直接用于sockaddr_in。

#include <sys/socket.h>
#include <netinet/in.h>
#include<arpa/inet.h>
 
atoi
字符串是ASCII
将字符串转为整数
#include <stdlib.h>
 
htons
16位主机字节序转为网络字节序
#include <arpa/inet.h> 
 

posted on 2021-04-03 20:35  toughcactus  阅读(69)  评论(0编辑  收藏  举报