Boost.Asio: "The parameter is incorrect" when assigning native socket
The error in the subject line occurs when attempting to assign a native socket to a Boost.Asio socket. I realize it's not very helpful since I'm not explaining where I am getting nativeSocket, but I was hoping someone let me know in general the cause of such an error, since there doesn't appear to be any documentation on it. I am almost positive that it is a valid socket, and its integer value is normally around 740. boost::asio::io_service ioserv; boost::asio::ip::tcp::socket s(ioserv); boost::system::error_code error; s.assign(boost::asio::ip::tcp::v4(), nativeSocket, error); if (error) cout << error.message() << endl;
tiredashell
The error in the subject line occurs when attempting to assign a native socket to a Boost.Asio socket. I realize it's not very helpful since I'm not explaining where I am getting nativeSocket, but I was hoping someone let me know in general the cause of such an error, since there doesn't appear to be any documentation on it. I am almost positive that it is a valid socket, and its integer value is normally around 740.
Is this on windows with native socket already mapped to a completion port?
This is indeed on Windows, and interestingly enough it does appear to work
on other platforms (OSX in particular does not give the error). I'm not
familiar with "completion ports" but I looked it up and it appears they are
created with "CreateIoCompletionPort" which doesn't exist anywhere in my
code. The socket in question is actually created in a fairly normal way:
SOCKET new_sock = INVALID_SOCKET;
new_sock = accept(svr_sock, (struct sockaddr*)&sin, &size);
After that, a few other things are done to the socket -- namely, setting it
as non-blocking using ioctlsocket, and using setsockopt for SO_LINGER
and SO_OOBINLINE. Any help is greatly appreciated.
On Mon, Nov 9, 2009 at 3:37 AM, Tore Halvorsen
tiredashell
writes: The error in the subject line occurs when attempting to assign a native socket to a Boost.Asio socket. I realize it's not very helpful since I'm not explaining where I am getting nativeSocket, but I was hoping someone let me know in general the cause of such an error, since there doesn't appear to be any documentation on it. I am almost positive that it is a valid socket, and its integer value is normally around 740.
Is this on windows with native socket already mapped to a completion port?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
tiredashell
-
Tore Halvorsen