Commit 9bd03303 authored by Yoann Pigné's avatar Yoann Pigné

Quick and Dirty fix to force the client to wait for the server to be available

parent 93c7246f
......@@ -40,7 +40,24 @@ _stream_name(stream),_host(host),_port(port),_stream(),_socket(host,port),debug(
void NetStreamSender::init()
{
_stream.writeString(_stream_name);
_socket.connect();
try{
_socket.connect();
} catch(NetStreamSocketException e){
std::cout<<"No available connection on "<<_host<<":"<<_port<<". Waiting.";
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();
}
}
......
......@@ -38,7 +38,8 @@ 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