Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

mesgsnd

Once the data is packaged as a message, it can be sent using the C-library function mesgsnd. As shown in the following example, mesgsnd takes a pointer to the message msgp of size msgsz bytes and sends it to the message queue identified by the Qkey mdest.

#include <sys/types.h>
#include <sys/ipc.h> |
#include <sys/msg.h>
#include "mesg.h"
#include "spp.h"

int mesgsnd(mdest,msgp,msgsz,msgflag)
int mdest; /* Message Qkey to send to */
union msgunion *msgp; /* message to send */
int msgsz; /* size of message */
int msgflag; /* flag for controlling send */

The mdest argument is set to TSM (defined in mesg.h) when the DIP wants to send a message to a script running on a channel. The msgflag argument is passed directly to the system call msgsnd and is used to determine the actions to take in case of an error. This flag is usually set to zero.

The mesgsnd function returns a zero upon successful completion. Otherwise, a negative value is returned.

The mesgsnd function creates the message queue if necessary.

© 2006 Avaya Inc. All Rights Reserved.