[asio] Cloning a WSA socket (windows)
Hi, I am trying to clone a socket from process to another, mostly for having one process per client in a network server. Some legacy stuff makes this the only design possible, so the threaded approach is simply not feasible... Anyway, when I'm trying to create a boost socket from a cloned WSA socket I get an exception. class boost::exception_detail::clone_impl< struct boost::exception_detail::error_info_injector< class boost::system::system_error >
: The parameter is incorrect
This same happens for this example program, using boost 1.37
Does anyone have an idea why this does not work?
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include
SOCKET copy(WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO , FROM_PROTOCOL_INFO, &info, NULL, NULL));
ip::tcp::socket scopy(ios, ip::tcp::v4(), copy);
For debug purposes, did you check what the value of "copy" is? Did you try to perform a simple winsock i/o operation on it? I.e., are you sure that you've got valid tcp socket descriptor?
On Tue, Feb 3, 2009 at 6:17 PM, Igor R
For debug purposes, did you check what the value of "copy" is? Did you try to perform a simple winsock i/o operation on it? I.e., are you sure that you've got valid tcp socket descriptor?
Good call. While copy != INVALID_SOCKET, but I get a "The system detected an invalid pointer address in attempting to use a pointer argument in a call." when I try to do a WSARecv. I should probably try a windows forum instead. -- Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul] <demo> 2009 Tore Halvorsen || +052 0553034554
While copy != INVALID_SOCKET, but I get a "The system detected an invalid pointer address in attempting to use a pointer argument in a call." when I try to do a WSARecv. I should probably try a windows forum instead.
I didn't try to debug your code, but at a glance, it seems that when duplicating socket, you pass current process id instead of *target* process id.
On Tue, Feb 3, 2009 at 8:03 PM, Igor R
I didn't try to debug your code, but at a glance, it seems that when duplicating socket, you pass current process id instead of *target* process id.
Right now I'm just trying to do it in a single program. -- Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul] <demo> 2009 Tore Halvorsen || +052 0553034554
participants (2)
-
Igor R
-
Tore Halvorsen