luvcloud
June 28th, 2002, 12:17 AM
Can anyone help me figure out what was causing the error. Here's the problem area:
i wrote a client/server app. The client will send msgs to the server and the server will raise the appropriate event (through delegates) and call the appropriate classes to process the msg. for example:
Try{
if (sMsgToken[0] == "GAMEJOIN")
{
Game(sMsgToken);
ReceiveMsgCallback(sock);
}
else if (sMsgToken[0] == "HOSTREMOVE")
{
Game(sMsgToken);
ReceiveMsgCallback(sock);
}
}
catch
{
Disconnect();
}
sMsgToken = the message received from the client
Game = an event. another class will be listening to this event and will call the event handler to process the necessary tasks.
First the GAMEJOIN message was sent. appropriate replies were then received from the server. But when the HOSTREMOVE message was sent next, the client is disconnected instead, which means the catch statement was executed.
So i tried to change the name of the event Game (for HOSTREMOVE) to a different name; GameRemove. And a different event handler was created for it. And it turned out fine.
So my question is, is it not possible to have same events raised by the different msgs? i mean, what was the problem?
i wrote a client/server app. The client will send msgs to the server and the server will raise the appropriate event (through delegates) and call the appropriate classes to process the msg. for example:
Try{
if (sMsgToken[0] == "GAMEJOIN")
{
Game(sMsgToken);
ReceiveMsgCallback(sock);
}
else if (sMsgToken[0] == "HOSTREMOVE")
{
Game(sMsgToken);
ReceiveMsgCallback(sock);
}
}
catch
{
Disconnect();
}
sMsgToken = the message received from the client
Game = an event. another class will be listening to this event and will call the event handler to process the necessary tasks.
First the GAMEJOIN message was sent. appropriate replies were then received from the server. But when the HOSTREMOVE message was sent next, the client is disconnected instead, which means the catch statement was executed.
So i tried to change the name of the event Game (for HOSTREMOVE) to a different name; GameRemove. And a different event handler was created for it. And it turned out fine.
So my question is, is it not possible to have same events raised by the different msgs? i mean, what was the problem?