I'm trying to write a little Client-Server application using the UNIX DOMAIN SOCKETS.
I'm using the msghdr
for the sendmsg
/recvmsg
but when I compile the following code, it gives me the following error:
include <sys/socket.h>
...
struct msghdr mh;
struct cmsghdr *cmp;
union{
struct cmsghdr cm;
char ctrl[sizeof(struct cmsghdr) + sizeof(int)];
} ctrlu;
...
mh.msg_name = NULL;
mh.msg_namelen = 0;
mh.msg_iov = iov;
mh.msg_iovlen = 1;
mh.msg_control = ctrlu.ctrl;
mh.msg_controllen = sizeof(ctrlu);
mh.msg_flags = 0;
Error message:
gcc s.c -o s -lsocket
s.c: In function `main':
s.c:59: error: structure has no member named `msg_control'
s.c:60: error: structure has no member named `msg_controllen'
s.c:61: error: structure has no member named `msg_flags'
* Error code 1