Hi.

I am writing component in C++ that uses messenger component.

I have a client function that send a string to the own component. As
follows:

 * void comp::sendMessageOtherAs(){
    ClientSocket theSocket ("localhost", 2603 );
    string request;
    request = "Test";
    theSocket << request << "\n";
    lg.dbg("Echo sent");
  }*

The server part is did by messenger component, calling the handle_message
function;

But the result, when the handle_message is invoked is:

*00108|messenger_core|DBG:Starting connection with idleInterval 0
00109|messenger_core|DBG:Received packet of length 0
00110|messenger|DBG:Message posted as Msg_event
00111|messenger_core|DBG:TCP socket connection accepted
00112|messenger_core|DBG:Copy 2 bytes to message
00113|messenger|DBG:Check message completeness 2 (expected 21349)
00114|messenger_core|DBG:Copy 31 bytes to message
00115|messenger|DBG:Check message completeness 33 (expected 21349)
00116|messenger_core|DBG:Received packet of length 3
00117|messenger_core|DBG:Received disconnection request
00118|messenger|DBG:Message posted as Msg_event
00119|messenger_core|DBG:socket closed
*
And the handler messenger has the code:

*switch (me.msg->type)
    {
    case MSG_DISCONNECT:
      return STOP;
      break;
    case MSG_ECHO:
      VLOG_DBG(lg, "Got echo request");
      reply_echo(me);
      return STOP;
      break;
    case MSG_ECHO_RESPONSE:
      VLOG_DBG(lg, "Echo reply received");
      return STOP;
      break;
    case MSG_NOX_STR_CMD:
      char mstring[ntohs(me.msg->length)-sizeof(messenger_msg)+1];
      memcpy(mstring, me.msg->body,
ntohs(me.msg->length)-sizeof(messenger_msg));
      mstring[ntohs(me.msg->length)-sizeof(messenger_msg)] = '\0';
      VLOG_DBG(lg, "Received string %s", mstring);
      break;
    }*

Shouldn't the message be of MSG_NOX_STR_CMD type and prints the string sent?
Or the way I am sending the string is wrong?

Sorry if I did'n made me clear.
Thanks for help.
Regards.

-- 
Ricardo Bennesby da Silva
Ciência da Computação - UFAM
LabCIA - Laboratório de Computação Inteligente e Autônoma
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to