AH, I see, this isn't a Windows program persay that's why they aren't using windows messaging to handle the events. But the basic idea is still the same. Where they have:
Is where you can call the class and function you need. An example would be lets say you setup a message called MSG_DOWNLOAD which has 1 assigned to it. When you send this message over the wire, it would fire in this the case event.PHP Code:switch (buffer[0])
{
default:
Disconnect(s);
cout << "This Client Has Disconnected: " << ClientIp << endl;
break;
case 1:
// DO SOMETHING IF YOU RECEIVE PACKET 1
break;
case 2:
// DO SOMETHING IF YOU RECEIVE PACKET 2
break;
}
}
So using the previous code it would go something like this:
PHP Code:switch (buffer[0])
{
default:
Disconnect(s);
cout << "This Client Has Disconnected: " << ClientIp << endl;
break;
case MSG_DOWNLOAD:
CSocket.Port_Connect(IP,PORT);
CSocket.Download(sDIR,sFILE_NAME);
break;
case 2:
// DO SOMETHING IF YOU RECEIVE PACKET 2
break;
}
}




Reply With Quote