- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My program uses 2 ports simultaneously in separate threads but when the second thread writes on its own connection with its own port it seems to complete successfully but does not send anything, I verified this using process monitor.
I have tried a single boost::asio::io_service for both threads and one for either thread, I tried calling run() on 1 or both threads or not at all and none of that makes a difference.
Here are the relevant methods:
const int conport=48625;
const int vidport=48624;
boost::asio::io_service iosvc;
boost::asio::ip::tcp::socket consock(iosvc);
void ControlThread::operator()(NameEdit* nameptr){
try{
boost::asio::ip::tcp::endpoint endp(boost::asio::ip::tcp::v6(), conport);
boost::asio::ip::tcp::acceptor acc(iosvc, endp);
iosvc.run();
boost::system::error_code ec;
acc: acc.accept(consock, ec);
boost::asio::streambuf buf;
auto n=boost::asio::read(consock, buf, boost::asio::transfer_exactly(1), ec);
buf.commit(n);
if(BufCast(buf)[0]!=2){
consock.close();
goto acc;
}
boost::asio::write(consock, boost::asio::buffer((char*)2, 1), boost::asio::transfer_exactly(1), ec);
ConMain(nameptr);
}catch(std::exception& ex){
MessageBoxExA(NULL, (LPCSTR)ex.what(), "Error", MB_ICONEXCLAMATION, 0);
}
}
boost::asio::ip::tcp::socket vidsock(iosvc);
void VideoThread::operator()(){
try{
boost::asio::ip::tcp::endpoint endp(boost::asio::ip::tcp::v6(), vidport);
boost::asio::ip::tcp::acceptor acc(iosvc, endp);
iosvc.run();
boost::system::error_code ec;
acc: acc.accept(vidsock, ec);
boost::asio::streambuf buf;
auto n=boost::asio::read(vidsock, buf, boost::asio::transfer_exactly(1), ec);
buf.commit(n);
if(BufCast(buf)[0]!=2){
vidsock.close();
goto acc;
}
boost::asio::write(vidsock, boost::asio::buffer((char*)2, 1), boost::asio::transfer_exactly(1), ec); // THIS write does not send
VideoThread::VidMain();
}catch(std::exception& ex){
MessageBoxExA(NULL, (LPCSTR)ex.what(), "Error", MB_ICONEXCLAMATION, 0);
}
}
I'm using boost 1.54 and Intel compiler v14 the visual studio 2012 project is an MFC executable.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Woops I meant Visual studio 2010, why cant I edit my post?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe your problem is not directly related to Intel Compiler?I suppose that the underlying networking stack which is called by boost::asio should blamed for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Btw try to use netmon it gives more detailed information about the process networking activity including connection setup and tear down.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't say the Intel compiler is the problem where else could I post this, I know theres something I'm not doing right I need someone to tell me what it is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
commanderlake wrote:
I didn't say the Intel compiler is the problem where else could I post this, I know theres something I'm not doing right I need someone to tell me what it is.
I do not really know where you can post this.May you try posting your question on boost library forum if one exists.
I was thinking on another possibility on how to investigate such issue.There is option to use debugger and try execution of your code with logexts logging extension in order to find which dll is beign called by boost::asio library.Next putting breakpoint on function call to probably Winsock library could hopefully reveal the culprit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks but I'm still relatively new to C++ as I do C# mostly, I need clear instructions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We can do it by sending private messages,but I encourage you still to search boost forums for the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cant find the boost forum.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look I do not use boost and I do not do any network related programming so I cannot offer any serious help,but if you are interested on how to troubleshoot such a problem please contact me privately(send private message).

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page