套接字地址结构
IPV4套接字地址结构
|
|
通用套接字
|
|
uint16_t htons(uint16_t host16bitvalue);
uint32_t htonl(uint32_t host32bitvalue);
uint16_t htonl(uint16_t net16bitvalue);
uint32_t ntohl(uint32_t net32bitvalue);
#include
void bzero(void dest, size_t nbytes);
void bcopy(const void src, void dest, size_t nbytes);
int bcmp(const void ptrl, const void *ptr2, size_t nbytes);
|
|
void memset(void dest, int c, size_t len);
void memcpy(void dest, const void src, size_t nbytes);
int memcmp(const void ptrl, const void *ptr2, size_t nbytes);
int inet_aton(const char strptr, struct in_addr addrptr);
in_addr_t inet_addr(const char strptr);
char inet_ntoa(struct in_addr inaddr);
```
readn, writen和readline函数
字节流套接字(例如TCP
套接字)上的read
和write
函数所表现的行为不同于通常的文件I/O。字节流套接字上调用read
或write
输入或输出的字节数可能比请求的数量少,然而这不是出错的状态。这个现象的原因在于内核中用于套接字的缓冲区可能已经达到了极限。