QNX Nuetrino MsgSendv

627 views Asked by At

I am using MsgSendv and server sends MSgReply like this:

char     desc_buf_out[MAX_CHARS_IN_A_LINE];
MsgReply(rcvid, EOK, desc_buf_out, sizeof(desc_buf_out));

My client is looking like this:

    iov_t              *iovrcv=calloc(1,sizeof(iov_t));
    char               rcv[1024]={0}
if (MsgSendv(server_coid, iovin_render, 3 , iovrcv, 1 ) == -1)
    {
        printf("error sending message to server\n");
        fprintf( stderr,
                 "%s: %s\n",
                 __func__,
                 strerror( errno ) );
        return EXIT_FAILURE;
    }

    SETIOV (iovrcv + 0, rcv, sizeof(rcv));
    printf("iovrcv=%s\n", rcv);

But I get nothing in my rcv buffer? Can you tell me why and what is the correct way of doing it so I receive my data correctly? I expect to receive string.

1

There are 1 answers

0
rkrten On

You are using the iovrcv uninitialized (well, ok, it's initialized with zeros via calloc, but it's not initialized to point to anything).

An iov_t is a pair of values, a pointer and a length.

It's given to the MsgSendv() function to tell it where the data should go. By leaving it uninitialized, you're telling MsgSendv() that the pointer is zero and the length is zero -- not a whole lot of data! :-)

Move your SETIOV to above the MsgSendv() function.

Also, be sure to initialize the iovin_render (which you show as having three parts, that is, three pairs of ptr/length values).