标签:c style class blog code java
#include <netinet/in.h>
struct in_addr {
in_addr_t s_addr; /* 32-bit IPv4 address */
}; /* network byte ordered */
struct sockaddr_in {
unit8_t sin_len; /* length of structure (16) */
sa_family_t sin_family; /* AF_INET */
in_port_t sin_port; /* 16-bit TCP or UDP port number */
/* network byte ordered */
struct in_addr sin_addr; /* 32-bit IPv4 address */
/* network byte ordered */
char sin_zero[8]; /* unused */
};
/* ============================================================================================================================ */#include <arpa/inet.h>
/* =========================================================================================================================== */
#include <sys/socket.h> ssize_t recvfrom(int sockfd, void *buff, size_t nbytes, int flags, struct sockaddr *from, socklen_t *addrlen); ssize_t sendto(int sockfd, const void *buff, size_t nbytes, int flags, const struct sockaddr *to, socklen_t addrlen);
返回:若成功则为读或写的字节数,若出错则为-1
标签:c style class blog code java
原文地址:http://www.cnblogs.com/StupidTortoise/p/3776818.html