msg_sendername
Previous Topic  Next Topic 

Synopsis: 

       task_id=msg_sendername()


Arguments: 

       none


Description: This function returns the task name (as set by a call to msg_setname()) for the task that sent the last message to the calling task.    This function can be used to determine where to send a return message to after receiving a message.


For example:


       msg_str=msg_read(30);

       // If a message was received..

       if(msg_str strneq "")

               // Get the task ID of the sending task

               return_name=msg_sendername();

               

               // make sure the return name is not blank

               if(return_name streq "")

                       // use the task ID instead

                       return_name=msg_senderid();

               endif

               

               

               // Send back an ACK message

               msg_send(return_name,"ACK");

       endif



Returns:   Returns the task name of the task that sent the last message received by the calling task, a blank string if no name was set or a -1 if no messages have been received.