Hello
I connect my WiFly successful to OF using the ofxTCPClient object.
Now, when I run the program before I connect the WiFly the program scan’s the net until the WiFly is connected, great, but if I stop the WiFly once it was connected the program want scan it again.
Is there a way that the (!tcpClient.isConnected()) is re-evaluated, so that the WiFly would be connected again.
Here is a copy of the code:
//--------------------------------------------------------------
void testApp::update(){
ofBackground(230, 230, 230);
//we are connected - lets send our text and check what we get back
if(weConnected){
if(tcpClient.send(msgTx)){
//if data has been sent lets update our text
string str = tcpClient.receive();
if( str.length() > 0 ){
msgRx = str;
}
}else if(!tcpClient.isConnected()){
weConnected = false;
}
}else{
//if we are not connected lets try and reconnect every 5 seconds
deltaTime = ofGetElapsedTimeMillis() - connectTime;
if( deltaTime > 5000 ){
weConnected = tcpClient.setup("1.2.3.4", 2000);
connectTime = ofGetElapsedTimeMillis();
}
}
}
Thanks Martin