Tuesday, January 26, 2016

Client - server communication problems (acute and sub-vine Brother, help ah!)




            


My server sends data to the client, why sometimes the customer can receive, but sometimes customers are abnormal exit? I told a little break, the problem here in iMessage.WriteL abnormal exit code is -38, the wrong descriptor dizzy.
My question is, since the problem lies in iMessage.WriteL here, but why not always quit, but is random, (send data) sometimes longer, sometimes shorter time.
Here is a client - server communication part of the code:
// CLIENT:
void RServerSession :: RequestStateData (TStateMsg & amp; aStateMsg, TRequestStatus & amp; aStatus)
{
TAny * messageParameters [KMaxMessageArguments];

TPckg & lt; TStateMsg & gt; StateMsg (aStateMsg);
messageParameters [0] = (TAny *) & amp; StateMsg;
SendReceive (ECyberWallServRequstState, messageParameters, aStatus);

}
// SERVER:
void CCyberWallServerSession :: SendStateMsgToClient ()
{

if (iWaitingForTick)
{
iWaitingForTick = EFalse;


iServer.GetStateMsg (iMyMsg);

TPckg & lt; TStateMsg & gt; hand_mymsg (iMyMsg);

TRAPD (err, iMessage.WriteL (iMessage.Ptr0 (), hand_mymsg));
if (err)
{
PanicClient (EBadDescriptor);

}

iMessage.Complete (ECyberWallServRequestComplete);
}
}
The problem lies in iMessage.WriteL (iMessage.Ptr0 (), hand_mymsg) sentence, I told breakpoints, abnormal exit code of -38 --- error descriptor, do not know how. If it is wrong descriptor, why did not the problem, but after a period of time.
// TStateMsg
struct TStateMsg
{
TInt AllSize;
TInt Count;
TInt DenyCount;
TInt FlowOver;};
Seeking Daren doubts, ah, I am troubled for a long time, the child rattan Brother, help ah.
Reply:
if (err)
{
PanicClient (EBadDescriptor);
}

Here you can not distinguish between err category?

Reply:
Oh, note that you have to accept iMessage is not exist, and you can save the best corresponding iMessage, so give iMessage to send messages which rely on him, careful study of the SDK comes with examples
Reply:
TPtr8 ptr (reinterpret_cast & lt; TUint8 * & gt; (& amp; time), sizeof (time), sizeof (time));
TRAPD (leave, iMessage.WriteL (iMessage.Ptr0 (), ptr)); try it this way.

No comments:

Post a Comment