apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject How to duplicate apr_socket_t?
Date Fri, 30 May 2014 09:54:15 GMT
Dear all,
Under unix/linux/mac, there is a dup() function to duplicated a file descriptor,  while under
windows (since vista) there are WSADuplicateSocket and WSASocket to do that.
Now apr_socket_t type doesn’t have that API, but has apr_os_sock_get to get system socket
from apr socket and apr_os_sock_put/apr_os_sock_make to make apr socket from system socket.

My question is can I implement a API like:
apr_socket_dup(apr_socket_t** duplicated, apr_socket_t* sock);
    //step1, get system sock
    //step2, duplicate the system sock
    //step3, make a new apr socket with the duplicated socket
   //step4, return the new apr socket.

Can you provide this API in the future?

TROY Represents Oh Yeah! :)

View raw message