常用函数

http://huiya1983.blog.163.com/blog/static/1365821692010411101441364/
[size=large][/size]

int getsockname(int socket, struct sockaddr *address, socklen_t *addrlen);
int getpeername(int socket, struct sockaddr *address, socklen_t *addrlen);

//  berkeley(伯克利):
void bzero(void *dest, size_t n);
void bcopy(const void *sour, void *dest, size_t n);
int  bcmp(const void *s1, const void *s2, size_t n);

//  ansi c:
void *memset(void *dest, int c, size_t n);
void *memcpy(void *dest, const void *sour, size_t n);//两者为同一指针,结果未知
int  memcmp(const void *s1, const void *s2, size_t n);


//  网络字节序,h、n、s、l的意思:host network short long
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);


//  适用于IPv4、IPv6,替代inet_aton、inet_notoa
const char *inet_ntop(int af,const void * src, char * dst, socklen_t size);
int inet_pton(int af, const char *restrict src, void *restrict dst);

//  点分十进制->网络二进制
int       inet_aton(const char *strptr, struct in_addr *addrptr);
//  和上一个一样,但不能处理"255.255.225.255",返回可误,废弃
in_addr_t inet_addr(const char *cp);
char     *inet_ntoa(struct in_addr in);

你可能感兴趣的:(C++,c,socket,C#,Blog)