The idea here is simple: some twelve year old punk logs in and after claiming he's the baddest thing on the continent proceeds to get schooled in ass-whuppin' and trash-talkin'. Fragile ego popped like a balloon, he takes a hacking tool someone posted on the internet and through his tears proceeds to try and teach a lesson to all those people who were trying to have a good time. Since there is no known cure for stupidity the only you can do is hope to foil his plans.
The most common method of crashing a computer game is a Denial of Service (DoS) attack. This is done by trying to log into a server so many times and so fast that the server can't handle them all without compromising the game quality. In extreme cases the server can be completely locked or even crash. It's called denial of service because the server is made so busy that it can't serve anyone else.
The only tactic I know of is to make your login go as fast as possible, but recently I was reading that John Carmack of Quake fame has found an intruiging solution: UDP out of bound data. UDP is another system for sending messages over the internet, the major difference between UDP and TCP/IP is that in UDP message can arrive in a different order than the one they were sent in, whereas TCP/IP always arrives in the same order it was sent. Out of bound (OOB) data is data that is sent on a "subfrequency" (ugh, to much star trek...). The beauty of OOB data is that it cannot cause a DoS attack on a server because once a certain ammount of data is waiting to be read no client can add to that queue, or at least this is my understanding. What it means is that you would send a request to be permitted to login through OOB data and after it is approved then you could connect. How do you send the UDP OOB request without having a socket open yet? Winsock 2.0 allows you to send connectionless data. I'd just like to note that I have not tried any of this UDP OOB connectionless stuff, it is merely conjecture based on my current understanding.
If you've made it this far you've now got a client and server up and running. You basic methodology would be something like this.
Client |
Server |
Init() |
Init() |
GetHost( remote IP ) |
GetHost( local IP ) |
SM_GETHOST with IP info and/or error code |
SM_GETHOST with IP info and/or error code |
Create socket. |
Create socket. |
WSAAsyncSelect() to set up socket flags FD_CONNECT | FD_READ | FD_SEND | FD_CLOSE |
WSAAsyncSelect() to set up socket flags FD_CONNECT | FD_READ | FD_SEND | FD_CLOSE | FD_ACCEPT |
|
AttemptConnect( port ) creates a listening socket. |
|
SM_ASYNC - FD_CONNECT notifies that AttemptConnect() is done and warns if there were any problems. |
AttemptConnect( port ) creates a socket to the server. |
SM_ASYNC - FD_ACCEPT notifies server that remote machine wishes to connect to this machine. |
SM_ASYNC - FD_CONNECT notifies client wether or not it succeeded in connecting. |
|
[transmit data] |
[transmit data] |
shutdown, cleanup & quit |
shutdown, cleanup & quit |
At this point there's only one socket message left to tackle, FD_CLOSE. The best way to close a socket (for either client or server) is to call shutdown( [the socket], SD_SEND ), read in any remaining data then call shutdown( [the socket], SD_BOTH ) and finally closesocket( [the socket] ). This will cause an FD_CLOSE message in the other machine. the SD_SEND flag tells the remote machine that no more data will be sent to the remote machine on this socket. That way the remote machine can read in whatever data is left pending and then use closesocket( [the socket] ) to get rid of it completely. No matter who calls shutdown() the other machine will get FD_CLOSE and the same process should be followed.
Now we have to add in all the communications between the server and the client(s). If your head doesn't hurt yet then think about this: You can send any kind of data you want back and forth but unless the other machine has some way of identifying it then it's meaningless ones and zeros. The solution is ...in next weeks' segment. BWAH HA HA, Headaches for everyone! BWAH HA HA HA...
|