Opened 12 years ago

Last modified 12 years ago

#5156 new Bugs

copying opened socket between processes (Microsoft Windows)

Reported by: irol@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

Hello, I use WSADuplicateSocket to copy opened socket from one process to another. I try to attach received socket:

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); this works fine

s1.assign(boost::asio::ip::tcp::v4(), receivedSocket); here is an error: nr=87 msg=Invalid Parameter I tried debug and it lead me to call CreateIoCompletionPort

What is wrong ? Is it a bug ? Or my misunderstanding ?

Regards, Irek Olchawski.

Change History (6)

comment:1 by Mateusz Loskot, 12 years ago

Component: Noneasio
Owner: set to chris_kohlhoff

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.

BTW, next time you will be reporting ticket, it's a good idea to select component/library corresponding to problem being reported.

comment:2 by irol@…, 12 years ago

Well, I'm quite sure that this code throws an exception. Best Regards, Irek Olchawski.

comment:3 by Mateusz Loskot, 12 years ago

Exception thrown does not necessarily mean there is a bug.

comment:4 by irol@…, 12 years ago

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'

comment:5 by Mateusz Loskot, 12 years ago

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.

Nevertheless, similar more complete report have been submitted here #5157

in reply to:  5 comment:6 by Irek Olchawski, 12 years ago

Replying to mloskot:

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.

Next strange thing is that If you ignore exception everything works fine. I can use assigned socket to communication.

Nevertheless, similar more complete report have been submitted here #5157

I read this. Exactly the same like mine.

Note: See TracTickets for help on using tickets.