Commit | Line | Data |
---|---|---|
dc0d77d7 CE |
1 | #include <sys/types.h> |
2 | #include <sys/param.h> | |
3 | #include <sys/socket.h> | |
4 | #include <netinet/in.h> | |
5 | #include "byte.h" | |
6 | #include "socket.h" | |
7 | ||
8 | int socket_send4(int s,const char *buf,int len,const char ip[4],uint16 port) | |
9 | { | |
10 | struct sockaddr_in sa; | |
11 | ||
12 | byte_zero(&sa,sizeof sa); | |
13 | sa.sin_family = AF_INET; | |
14 | uint16_pack_big((char *) &sa.sin_port,port); | |
15 | byte_copy((char *) &sa.sin_addr,4,ip); | |
16 | ||
17 | return sendto(s,buf,len,0,(struct sockaddr *) &sa,sizeof sa); | |
18 | } |