ofxTCPManager.receive() - EWOULDBLOCK on Windows #590

cristobal opened this Issue May 31, 2011 · 2 comments


None yet
4 participants

ofxNetworkUtils.h - issue 1

The default message should print out err instead of errno

        ofLog(OF_LOG_ERROR,"ofxNetwork:"+file+": " +line+" unknown error: " + ofToString(errno) + " see errno.h for description of the error");


        ofLog(OF_LOG_ERROR,"ofxNetwork:"+file+": " +line+" unknown error: " + ofToString(err) + " see errno.h for description of the error");

Since errno would not be set on windows machines.

ofxTCPManager.cpp - issue 2

In the Receive method of the ofxTCPManager the function will always return -1 when checking for data and there is no new data and the TCPServer has been set to non-blocking.

After changing the code in issue 1 mentioned above i got:

ofxNetwork:addons\ofxNetwork\src\ofxTCPManager.cpp: 304 unknown error: 10035 see errno.h for description of the error

instead of error: 0 when errnowas used.

Which on windows is the WSAEWOULDBLOCK or EWOULDBLOCK as defined in ofxNetworkUtils

So someplace in the code there should be a mechanism to check if the code is client is non-blocking and ignore the error.
This is windows only but still could be as an additional parameter to the Receive method. Or add it as an switch case for the EWOULDBLOCK in the ofxNetworkUtils and ignore the ouput and comment it.

I just noticed this above when i started usin an application that i was developing on my mac an using it on windows machines this code would appear too often.

So as stated above my solution is that i added:

        #ifdef TARGET_WIN32 // otherwise EAGAIN & EWOULDBLOCK will create a "duplicate case value" on Non windows
    case EWOULDBLOCK: 
        //  ofLog(OF_LOG_VERBOSE,"ofxNetwork:"+file+": " +line+" EWOULDBLOCK: perhaps non-blocking");

code and ignoring the output.


SoylentGraham commented Nov 2, 2013

I believe issue 2 would be fixed with my pull request;

(Not necessarily the output, but 0 would be returned and the socket won't get closed)

@bilderbuchi bilderbuchi modified the milestones: 0.8.3, 0.8.2 May 4, 2014

@bilderbuchi bilderbuchi modified the milestones: 0.8.4, 0.9.0 Aug 10, 2014

@bilderbuchi bilderbuchi modified the milestones: 0.9.0, 0.9.1 Sep 3, 2014

@kylemcdonald kylemcdonald modified the milestones: 0.9.3, 0.9.1 Dec 6, 2014


kylemcdonald commented Dec 12, 2014

closed by #2659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment