how to use sendmsg() system call in server client program

114 Views Asked by At

I'm going through sendmsg systemcall, i want to trigger this sendmsg systemcall using a server client programs and what to use ftrace to trace what functions are involved and understand the flow of sendmsg

1

There are 1 best solutions below

1
Chin2 On

You can invoke the msgsnd() system call as follows. Reference

syntax:

int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);

int ret = msgsnd(msq_id, &msg, sizeof(msg.data), 0);
    if(ret< 0){
        perror("msgsnd() failed");
        _exit(-1);
    }
// message is sent