使用例:
#include
#include
int sd; /* socket descriptor */
int count; /* number of bytes transmitted */
char buf[100]; /* transmission buffer */
int len; /* max number of bytes transmitted */
int flags; /* for handling special messages */
struct sockaddr_in to, from; /* endpoint addresses */
int addrlen; /* length of address structure */
count = sendto( sd, buf, len, flags, (struct sockaddr*) &to, addrlen );
count = recvfrom( sd, buf, len, flags, (struct sockaddr*) &from, &addrlen );
沒有留言:
張貼留言