Boost logo

Boost Users :

Subject: [Boost-users] [asio] asio-client only connects to server when on same machine
From: Grotjahn Clemens (CM-AI/PJ-CF22) (Clemens.Grotjahn_at_[hidden])
Date: 2010-01-14 07:46:14


hi everybody,

i have an issue with my asio-client that wants to connect to
an asio-server. when i set my server on a machine in our
network to listening on a port (>1024) and then try to connect
with my client via this port, i get a "Connection refused"-exception.
this happens every time the server and client are located on different
machines. if i try this on the same machine it works fine!
also, if i try to connect via telnet from another machine it works!

here's the client-setup-code snippet, maybe i missed a special config there?:
   tcp::resolver resolver( _io ); //_io is class-member
   tcp::resolver::query query( server, port ); //server and port are char-buffers
   tcp::resolver::iterator iter = resolver.resolve( query );
   _socket = new tcp::socket( _io );
   tcp::resolver::iterator end; // End marker.
   boost::system::error_code error = error::host_not_found;
   while (error && iter != end)
   {
      _socket->close();
      _socket->connect(*iter++, error);
   }
   if (error)
      throw boost::system::system_error( error );
   }
   catch( std::exception& e )
   {
      cout << "NetClient Konstruktor: " << e.what() << endl;
   }



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net