Issues using Syphon in a command line tool

Home Forums Syphon Syphon Development – Developer Issues using Syphon in a command line tool

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #58949
    paperManu
    Participant

    Hi there,

    I’m currently trying to add Syphon support to a tool I ported from Linux to OSX, which means that it is not a XCode project but an autotools-based one.

    A few years ago (in the 10.7 era as far as I remember) I did something similar, adding Syphon to a command line tool, and it worked flawlessly. No need to say that it is not the case now for an unknown reason.

    Here is my current issue. I can’t even get the Syphon server list with this simple code:

    
    bool SyphonReceiver::connect(const char* serverName, const char* appName)
    {
        NSArray* serverMatches = [[SyphonServerDirectory sharedDirectory] servers];
        printf("-----> server matches: %i\n", (int)[serverMatches count]);
        
        return true;
    }
    

    I tried it in a command line tool created from scratch using XCode and I don’t get anything either.

    As anybody been facing the same kind of issue? Am I forgetting some kind of initialization step? Could it be some form of sandboxing issue?

    Thanks in advance for your help.

    #58950
    bangnoise
    Keymaster

    Hi

    If your main thread isn’t servicing a run-loop (as it may not be in a command-line tool), then the notifications for server discovery won’t get serviced.

    For example, the following works:

        SyphonServerDirectory *sharedDirectory = [SyphonServerDirectory sharedDirectory]; // Accessing it causes Syphon to begin finding servers
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
        serverMatches = [sharedDirectory servers];
    • This reply was modified 5 years, 11 months ago by bangnoise.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.