xref: /plan9/sys/src/ape/lib/bsd/sendto.c (revision 781103c4074deb8af160e8a0da2742ba6b29dc2b)
1 /* posix */
2 #include <sys/types.h>
3 #include <unistd.h>
4 #include <fcntl.h>
5 #include <errno.h>
6 
7 /* bsd extensions */
8 #include <sys/uio.h>
9 #include <sys/socket.h>
10 
11 #include "priv.h"
12 
13 int
sendto(int fd,void * a,int n,int flags,void *,int)14 sendto(int fd, void *a, int n, int flags, void *, int)
15 {
16 	/* actually, should do connect if not done already */
17 	return send(fd, a, n, flags);
18 }
19 
20 int
recvfrom(int fd,void * a,int n,int flags,void * from,int * fromlen)21 recvfrom(int fd, void *a, int n, int flags,
22 	void *from, int *fromlen)
23 {
24 	if(getsockname(fd, from, fromlen) < 0)
25 		return -1;
26 	return recv(fd, a, n, flags);
27 }
28