An application written to communicate through Windows Sockets with a transport that supports connect data should call setsockopt with SOL_SOCKET as the level, SO_CONNDATA as the option name, and an option value that is a pointer to a buffer containing the connect data the transport should send to the remote node with the connection request. Such an application must call setsockopt before it calls connect, and the application-supplied connect data is transmitted when the application makes its call to connect.
Besides making a call to connect, retrieving response-connect data requires two additional steps:
After an application has set up a response-connect buffer, Windows Sockets uses that buffer for the lifetime of the socket. That is, an application can retrieve response-connect data for a particular socket at any time after the socket is connected and before it is closed.