Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~2K People Reached
Favorite Forums
Favorite Tags
Member Avatar for MixedCoder

[CODE]Server::Server(boost::asio::io_service& io_service,std::string ip,short port,std::shared_ptr<ConnectionFactory> factory) : acceptor_(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4::from_string(ip.data()), port)){ m_factory = factory; start_accept(); std::cout<<"Socket accepting connections..."<<std::endl; } Server::~Server() { } void Server::start_accept(){ boost::asio::io_service io_service; std::shared_ptr<Connection> conn = m_factory->create(io_service); acceptor_.async_accept(conn->socket(), boost::bind(&Server::handle_accept, this,conn, boost::asio::placeholders::error)); } void Server::handle_accept(std::shared_ptr<Connection> conn,const boost::system::error_code& error){ if (!error) { std::cout<<"on connected"<<std::endl; conn->OnConnected(); start_accept(); } } [/CODE] when i …

Member Avatar for lcordero
0
541
Member Avatar for MixedCoder

[CODE]class Connection { public: typedef boost::shared_ptr<Connection> pointer; static pointer create(boost::asio::io_service& io_service){return pointer(new Connection(io_service));} explicit Connection(boost::asio::io_service& io_service); virtual ~Connection(); boost::asio::ip::tcp::socket& socket(); -->>>virtual void OnConnected()=0; void Send(uint8_t* buffer, int length); bool Receive(); private: void handler(const boost::system::error_code& error, std::size_t bytes_transferred ); boost::asio::ip::tcp::socket socket_; };[/CODE] when am trying to use virtual void OnConnected()=0; it …

Member Avatar for mike_2000_17
0
432
Member Avatar for MixedCoder

[CODE] try { boost::asio::io_service io_service; tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v4(), 13)); for (;;) { tcp::socket socket(io_service); acceptor.accept(socket); //how do i make a checker here if the client is not sending anything then server send or if the client sending then server recive } } catch (std::exception& e) { std::cerr << e.what() << …

0
68
Member Avatar for MixedCoder

is there is a tutorial about how to use boost:asio how to send how to recive , coz all the tutorials i checked is only showin me an example of server source or a client source. so please if there is one link me to it thnx alot :)

0
111
Member Avatar for MixedCoder

[code]#include <iostream> #include <WinSock2.h> #include <mysql.h> #include <string> #include <vector> #include "action.h" using namespace std; MYSQL *con; st_mysql_res* res = NULL; MYSQL_FIELD * field[200]; MYSQL_ROW myRow; CAction * m_pActionList[1000]; int LoadActions(); int main() { con = mysql_init(con); if(!mysql_real_connect(con,"127.0.0.1","test","test","account_zf",NULL,NULL,NULL)) { cout<<"Error connected"<<endl; system("pause"); exit(-1); return false; } LoadActions(); system("pause"); return 0; …

Member Avatar for MixedCoder
0
248
Member Avatar for MixedCoder

[CODE] #include <Windows.h> #include <iostream> #include <mysql.h> using namespace std; int main() { MYSQL *conn; char names; names= mysql_query(conn,"select * from names"); return 0; } [/CODE] error: Error 1 error C2440: '=' : cannot convert from 'int' to 'char *' i want to set a varuable for the query so …

Member Avatar for gerard4143
0
197
Member Avatar for MixedCoder

[CODE]#include <WinSock2.h> #include <WinSock.h> #include <process.h> #include <time.h> #include <iostream> using namespace std; class PoPSocket { public: void Socket() { const int iReqWinsockVer = 2; // Minimum winsock version required WSAData wsaData; if (WSAStartup(MAKEWORD(iReqWinsockVer,0), &wsaData)==0) { // Check if major version is at least iReqWinsockVer if (LOBYTE(wsaData.wVersion) >= iReqWinsockVer) { …

Member Avatar for MixedCoder
0
286