Boost C++ Libraries: Ticket #5156: copying opened socket between processes (Microsoft Windows) https://svn.boost.org/trac10/ticket/5156 <p> Hello, I use WSADuplicateSocket to copy opened socket from one process to another. I try to attach received socket: </p> <p> boost::asio::io_service io_service; tcp::socket s1(io_service); ... here I'v got opened socket (receivedSocket) through shared memory from other process ... using WSADuplicateSocket char sText[] = "Open socket received !\r\n"; int nRet = send(receivedSocket, sText, strlen(sText), 0); <em> this works fine </em></p> <p> s1.assign(boost::asio::ip::tcp::v4(), receivedSocket); <em> here is an error: nr=87 msg=Invalid Parameter I tried debug and it lead me to call <a class="missing wiki">CreateIoCompletionPort</a> </em></p> <p> What is wrong ? Is it a bug ? Or my misunderstanding ? </p> <p> Regards, Irek Olchawski. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5156 Trac 1.4.3 Mateusz Loskot Fri, 18 Feb 2011 21:33:12 GMT component changed; owner set https://svn.boost.org/trac10/ticket/5156#comment:1 https://svn.boost.org/trac10/ticket/5156#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">asio</span> </li> </ul> <p> I believe it's not a confirmed bug and seems you are unsure as well. This is a question which belongs to boost-users mailing list. I would suggest to close as invalid. </p> <p> BTW, next time you will be reporting ticket, it's a good idea to select component/library corresponding to problem being reported. </p> Ticket irol@… Fri, 18 Feb 2011 21:37:26 GMT <link>https://svn.boost.org/trac10/ticket/5156#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5156#comment:2</guid> <description> <p> Well, I'm quite sure that this code throws an exception. Best Regards, Irek Olchawski. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Fri, 18 Feb 2011 21:49:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5156#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5156#comment:3</guid> <description> <p> Exception thrown does not necessarily mean there is a bug. </p> </description> <category>Ticket</category> </item> <item> <author>irol@…</author> <pubDate>Fri, 18 Feb 2011 22:21:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5156#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5156#comment:4</guid> <description> <p> If it is not a bug why it throws ? Maybe you should change documentation. Let say: 'socket::assign throws an exception. Catch it and ignore' </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Fri, 18 Feb 2011 22:57:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5156#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5156#comment:5</guid> <description> <p> Certainly, the socket::assign can throw on error. No need to change the documentation. I'm not saying it is not a bug. I'm suggesting an exception is a perfectly valid situation and the fact an exception is thrown does not necessarily mean it is caused by a bug. </p> <p> Nevertheless, similar more complete report have been submitted here <a class="new ticket" href="https://svn.boost.org/trac10/ticket/5157" title="#5157: Bugs: Assign native socket problem (new)">#5157</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Irek Olchawski</dc:creator> <pubDate>Sat, 19 Feb 2011 06:52:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5156#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5156#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/5156#comment:5" title="Comment 5">mloskot</a>: </p> <blockquote class="citation"> <p> Certainly, the socket::assign can throw on error. No need to change the documentation. I'm not saying it is not a bug. I'm suggesting an exception is a perfectly valid situation and the fact an exception is thrown does not necessarily mean it is caused by a bug. </p> </blockquote> <p> Next strange thing is that If you ignore exception everything works fine. I can use assigned socket to communication. </p> <blockquote class="citation"> <p> Nevertheless, similar more complete report have been submitted here <a class="new ticket" href="https://svn.boost.org/trac10/ticket/5157" title="#5157: Bugs: Assign native socket problem (new)">#5157</a> </p> </blockquote> <p> I read this. Exactly the same like mine. </p> </description> <category>Ticket</category> </item> </channel> </rss>