winsock - dealing with errors

Started by
-1 comments, last by robolee 12 years, 2 months ago
For a bit of info I'm using Async TCP and here's my networking code in it's entirety, excluding the header file which basically includes just the functions prototypes and the "Socket" and "client_data_struct" structs:

Message handling:

case WM_SOCKET:
switch (WSAGETSELECTEVENT(lParam)){
case FD_CONNECT: connected(WSAGETSELECTERROR(lParam)); break;//successfully connected to server (client)
case FD_ACCEPT: accept_connection(); break;//recieved connect attempt (server)
case FD_CLOSE: close_connection(wParam, WSAGETSELECTERROR(lParam)); break;//socket closed (server)
case FD_READ: recieve_data(wParam); break;//data recv'd wparam=socket (both)
}
break;

networking code:
http://pastebin.com/8rxTvFJK

So yeah I was just wanting tips on how to deal with the errors, and also any tips on how to improve the code for error checking in general would be great. Also are there any noticeable problems/instabilities in my code? (note it's all working fine except that my code doesn't really handle errors, I have used to send and receive data across a network)


edit: Okay it seems nobody is interested in helping with generic issues like this, I admit it's not a direct problem with a simple answer. I just wanted to hear some helpful tips and stuff and confirmation that my networking code is at least okay (it works well enough so far). Whatever it's not essential and I was going to go ahead with it regardless, if you want to use my code feel free.

This topic is closed to new replies.

Advertisement