Exemple #1
0
int On_VS_ConnectionReceived(Aris::Core::CONN *pConn, const char* addr,int port)
{
    Aris::Core::MSG msg;
    msg.SetMsgID(VS_Connected);
    msg.SetLength(sizeof(port));
    msg.Copy(&port,sizeof(port));
    msg.CopyMore(addr,strlen(addr));
    PostMsg(msg);
    return 0;
}
int On_CS_DataReceived(Aris::Core::CONN *pConn, Aris::Core::MSG &data)
{
    int cmd_id=data.GetMsgID();
    Aris::Core::MSG CMD;
    CMD.SetMsgID(CS_CMD_Received);
    CMD.SetLength(sizeof(int));
    CMD.Copy(&cmd_id,sizeof(int));
    
    // if the cmd has data, it should be repost together
    CMD.CopyMore(data.GetDataAddress(), data.GetLength());

    cout<<"received CMD is "<<cmd_id<<endl;

    PostMsg(CMD);
    return 0;
}