WSAStartup - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

WSAStartup

bogdanul2003bogdanul2003 Posts: 153Member
Do I need to call WSAStartup for each thread or it's enough to call it once per application ?If a server recevies a connection and sends the socket returned by accept to another thread that will take care of the client do I have to call WSAStartup again?

10x

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    : Do I need to call WSAStartup for each thread or it's enough to call it once per application ?If a server recevies a connection and sends the socket returned by accept to another thread that will take care of the client do I have to call WSAStartup again?
    :
    : 10x
    :

    [code]
    An application or DLL can call WSAStartup more than once if it needs to
    obtain the WSADATA structure information more than once. On each such
    call the application can specify any version number supported by the
    DLL.

    An application must call one WSACleanup call for every successful
    WSAStartup call to allow third-party DLLs to make use of a WS2_32.DLL on
    behalf of an application. This means, for example, that if an
    application calls WSAStartup three times, it must call WSACleanup three
    times. The first two calls to WSACleanup do nothing except decrement an
    internal counter; the final WSACleanup call for the task does all
    necessary resource deallocation for the task.
    [/code]

    Looks like you need to call it for each thread and DLL.
Sign In or Register to comment.