CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    44

    Asynchronous Vs Synchronous Sockets

    Hi All,

    I want to know the difference between Asynchronous and Synchronous Sockets.

    where can i get them ?

    Thanks

  2. #2
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    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.

  3. #3
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    628

    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
  •  





Click Here to Expand Forum to Full Width

Featured