I've made unit test for this problem.
Server.h:
#pragma once
#include
#include
#include
#include <iostream>
class Server
{
public:
AssistGui(boost::asio::io_service &);
~AssistGui(void);
void accept(const boost::system::error_code& e);
void sendMsg(const char *msg, unsigned int size);
private:
boost::asio::io_service &io;
boost::asio::ip::tcp::socket _client;
boost::asio::ip::tcp::acceptor _acceptor;
};
Server.cpp:
#include "Server.h"
using boost::asio::ip::tcp;
Server::Server(boost::asio::io_service &ios) : io(ios), _client(ios), _acceptor(ios, tcp::endpoint(tcp::v4(), 14242))
{
_acceptor.async_accept(_client, boost::bind(&Server::accept, this, boost::asio::placeholders::error));
}
void Server::sendMsg(const char *msg, unsigned int size)
{
}
Server::~Server(void)
{
}
void Server::accept(const boost::system::error_code& e)
{
// same error :-( : "Already open"
}
int main()
{
boost::asio::io_service ios;
Server s(ios);
ios.run();
}
The error is still the same "Already open".
_WIN32_WINNT=0x0501 is defined.
I tried to change port.
No warnings at program compilation.
Can you help me?
Thank you
Cyprien DIOT
----- Mail original -----
De: "Igor R"
À: boost-users@lists.boost.org
Envoyé: Jeudi 10 Mars 2011 00:42:24
Objet: Re: [Boost-users] [ASIO] async_accept : Error m_val 1.
m_val = 1;
m_cat = 0x00ab8d00 instance;
| [boost::asio::error::detail::misc_category] = {...}
| boost::noncopyable_::noncopyable = {...}
| __vfptr = 0x00a8bf18 const boost::asio::error::detail::misc_category::`vftable'
Use message() member function of error_code to see the error description.
IIUC, in your case it should be "Already open", i.e. you're trying to
accept new connection to a socket which was already open.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users