|
-
August 12th, 2005, 04:32 AM
#1
Asynchronous Vs Synchronous Sockets
Hi All,
I want to know the difference between Asynchronous and Synchronous Sockets.
where can i get them ?
Thanks
-
August 12th, 2005, 08:31 AM
#2
Re: Asynchronous Vs Synchronous Sockets
Try this for the differences. I dont understand what you mean by "where can i get them ?".
HTH,
Regards,
Usman.
-
August 12th, 2005, 09:17 AM
#3
Re: Asynchronous Vs Synchronous Sockets
you use winsock.. if you are using vc++, you should already "have them".
i have only worked with winsock 1.1.. so i can show you how to set up your project to use that.. but i don't know how to do it wiht winsock 2 (which you should use...)
for winsock 1.1, to to project->settings, link tab and add "wsock32.lib" at the end of the list (or it might be empty depending on your project) of object/library modules.
place this code before you do any socket operations (it starts up winsock)
Code:
WORD wVersionRequested = MAKEWORD(1,1);
WSADATA wsaData;
int nRet;
nRet = WSAStartup(wVersionRequested, &wsaData);
if (wsaData.wVersion != wVersionRequested)
{
fprintf(stderr,"\n Wrong version\n");
return;
}
once you've done that, you are good to use socket operations..
but since it seems you are just starting out with sockets programming, i would recommend you try and find out how to do the same process for winsock 2.. (it is different)..
the appropriate file to include is "winsock.h" for the old version.
oh.. synchronous and asynchronous are also called blocking and non-blocking.. i'm sure you will come across either pair of words when you do your research.. personally i prefer to call them blocking/nonblocking since it describes their behaviour.. i can never keep synhc, asynch straight..
Last edited by drewdaman; August 12th, 2005 at 09:20 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|