Sign in to follow this  
robolee

winsock - dealing with errors

Recommended Posts

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:
[CODE]
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;
[/CODE]
networking code:
[url="http://pastebin.com/8rxTvFJK"]http://pastebin.com/8rxTvFJK[/url]

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this