networkTcpServerExample crash on exit if it runs without networkTcpClientExample

OF 0.8.3 and 0.8.4 / OSX 10.10 / Xcode 5.1

I’ve tried several times and it happened very often. When I press “esc” I get signal SIGBART at line 129 in ofThread.cpp, inside ofThread::waitForThread in correspondence of the call to thread.join()

 if (INFINITE_JOIN_TIMEOUT == milliseconds){
            thread.join();
        }else{
            // Wait for "joinWaitMillis" milliseconds for thread to finish
             if(!thread.tryJoin(milliseconds)){
                ofLogError("ofThread") << "- name: " << getThreadName() << " - Unable to completely waitForThread.";
            }
        }

waitForThread is called by ofxTCPServer::close() in the destructor of the class.

This makes this Addon hard to use, because it’s almost sure that your applications will crash/freeze on exit if no clients will connect to the server.

I’m not expert about multi-threading, so I hope someone will help me with some suggestion

thanks

Paolo

Hi,
I also use Xcode,
You can try Poco TCPServer.

I use Poco to communicate with Google and it is a joy.

http://www.appinf.com/docs/poco/Poco.Net.TCPServer.html

Thanks! However ofxTCPServer is based on Poco, so it should be very similar.

Regarding OF, I’ve found that if I set log level to OF_LOG_VERBOSE the application looks more stable… just a tip for those ones who want to look at the code.

Hey @Paolo, ofxNetwork is not poco based. I’m sure it will be eventually, but for now it’s not and there are different issues depending on what OS your on. I would follow @PetaFemto’s advice and try poco’s tcp libraries, it’s much more stable.

Not exactly a drop-in replacement for ofxNetwork, but here’s a wrapper/addon i’ve been using https://github.com/trentbrooks/ofxTCPPoco (tested on android, ios, and osx only).

Thanks very much @trentbrooks for your tips. I don’t know what made me think that ofxNetworks was poco based, anyway it could be useful to report these OS issues in a readme file.