Commit 8a5d71b1 authored by Yoann Pigné's avatar Yoann Pigné

client waits for server forever, but no recursion

parent a0009e2f
......@@ -40,30 +40,25 @@ _stream_name(stream),_host(host),_port(port),_stream(),_socket(host,port),debug(
void NetStreamSender::init()
{
_stream.writeString(_stream_name);
int wait_for_server = 1;
while(wait_for_server){
try{
_socket.connect();
if(wait_for_server > 1)
std::cout<<std::endl<<"Connection established."<<std::endl;
wait_for_server = 0;
} catch(NetStreamSocketException e){
if(wait_for_server == 1)
std::cout<<"No available connection on "<<_host<<":"<<_port<<". Waiting.";
else
std::cout<<"."<<std::flush;
wait_for_server++;
sleep(1);
_connect();
std::cout<<std::endl<<"Connection established."<<std::endl;
}
}
void NetStreamSender::_connect(){
try{
_socket.connect();
} catch(NetStreamSocketException e){
std::cout<<"."<<std::flush ;
sleep(1);
_connect();
}
}
// ===========================================
// = Values type guess (templates) =
// ===========================================
......
......@@ -38,7 +38,6 @@ protected:
bool debug;
void init();
void _connect();
template <typename T>
int getType(T t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment