Can You Explain What This Piece of Code Does? C++ - Winsock - Simple

What does the following code do? Please explain each line...
Why we need to put in Windows Socket Programs?
Why we do not use it in Linux or Unix?
Why at the end we do cleanup?

1
2
3
4
5
6
7
8
9
10
11
    WORD wVersionRequested;
    WSADATA wsaData;
    int err;

    wVersionRequested = MAKEWORD(2, 2);

    err = WSAStartup(wVersionRequested, &wsaData);
    if (err != 0) {                         
        printf("WSAStartup failed with error: %d\n", err);
        return 1;
    }



Like you say - it's simple.
here is what YOU do - put WSAStartup into google - one of the first (if not the first) pages google will find is this one:
http://msdn.microsoft.com/en-us/library/ms742213(VS.85).aspx

Read it.
Like you say - it's simple.

lol you got me

Thanks
Last edited on
Topic archived. No new replies allowed.