Detaching a native socket from Boost.ASIO's socket class

后端 未结 2 1339
别跟我提以往
别跟我提以往 2021-01-18 07:23

Is it possible to detach a native socket from Boost.ASIO\'s socket class? If so, how can it be done? I can\'t seem to find anything obvious in the documentation.

As

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 07:40

    Answering my own question.

    Windows has a WSADuplicateSocket function, which can be used to duplicate the native socket. The underlying socket will remain open until all descriptors for this socket are deallocated.

    http://msdn.microsoft.com/en-us/library/ms741565(VS.85).aspx

提交回复
热议问题