Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

sockets (failure to bind them in PyGaze)

Hi,

I've succeeded in connecting my Windows 7 stimulus computer and Windows XP SMI eyetracker, but when I run PyGaze Init in OpenSesame, I get this error:

Exception: Error in libsmi.SMItracker.init: establishing connection failed; BIND_SOCKET: failed to bind sockets

Someone else had a similar question 3 years ago, when PyGaze support for SMI was experimental, but there wasn't really a solution then. And now there's no one at SMI to contact. Has anyone come up with a remedy since?

Thanks,

Russell

Comments

  • Hi Russell,

    What are the IP address and send/receive ports that you're using?

    Specifically: Are you running the experiment on the same computer that is running iViewX, or are you running it on a different computer that is connected via an ethernet cable?

    Cheers,

    Edwin

  • Hi Edwin,

    OMG, I don't know how I missed your response more than a month ago. Thank you so much for responding. Here is some more information:

    I'm using the 2-PC setup. My stimulus computer has the IP address 192.168.0.1 and Port 5555. The SMI Workstation has IP address 192.168.0.2 and Port 4444. They're connected with an ethernet cable. Also, in pygaze_init, "SMI send-port number" is 4444 and "receive-port number" is 5555. By the way, since I wrote I've upgraded the stimulus computer to a brand-new Alienware gaming laptop my dissertation advisor had.

    I have been trying to run the OpenSesame eyetracking template. I'm attaching the error log. The stimulus computer does seem to be communicating with the SMI Workstation because the Workstation's System Log/User tab reports "Grab started/Grab stopped" every time I run the OS template.

    Earlier, I tried to run the VS C# demo in the SDK and got the error "iV_connect: failed to establish connection." Also, even though I had checked off Stream Data under SetUp/Hardware/Communication on the SMI Workstation, the System Log/User tab reported that Data Streaming, Eye Video Streaming and Scene Video Streaming had all been disabled--then when I went back to look, the Stream Data box was unchecked! Again, the stimulus computer was definitely talking to the workstation, because the System tab reported a whole series of "Remote command executed" statements, including ET_EIM, ET_ESV, ET_EST and ET_EFX -- none of which I can find in the manual! (These statements were not reported for the OpenSesame eyetracking template runs.)

    So the 2 computers do seem to be connected, but I still get this "failure to bind socket" error.

    I hope something in the above clarifies the situation.

    Thank you again for your help & attention. It all sounds so easy in the SMI manual!

    best,

    Russell




  • edited July 30

    Hi Russell,

    By default, the SMI implementation assumes iViewX is running on the same computer. You'd need to change the following line linked below (line 208 in pygaze/_eyetracker/libsmi.py) to the following:

    res = iViewXAPI.iV_Connect(c_char_p("192.168.0.2"), c_int(4444), c_char_p("192.168.0.1"), c_int(5555))
    


    https://github.com/esdalmaijer/PyGaze/blob/master/pygaze/_eyetracker/libsmi.py#L208

    Sorry for the hacky solution!

  • Hi Edwin,

    Thanks--hacky or not, this helped a little. I also changed the IP address in the definition of _init_ from the default to the actual address of the SMI workstation. Now I don't get the "bind socket" error. Instead I get the error "failed to establish connection." This is with OS 3.2.8. 

    However...when I went back to 3.2.7, the connection _was_ made. Only in this case, the eyetracking template experiment ran never got through the practice loop.

    First, there was no instructions sketchpad, just a grey screen with a black dot. The dot didn't move, but there seems to have been a calibration because the iViewX workstation reported "Calibration finished successfully."

    After a while, I hit the space bar, and then it took about 30 seconds, but the cursor began to move, first with about 15 seconds between moves, then at normal speed. The iView X workstation recorded a series of Deviations at that time.

    When that sequence stopped, the screen didn't change. I hit the space bar again and the grey screen disappeared, to be replaced by a smaller black screen with a white dot, a whole other calibration setup! This ran for a few seconds then crashed in "calibrate," libsmi.py line 338, as follows:

    XRMS = (sum(Xvar) / len(Xvar))**0.5

    Zero Division Error: integer division or modulo by zero

    Perhaps since I seem to have gotten past the connection problem by using 3.2.7, I should start a new string. I hope it's ok that I include this here, since it seems like a slow, step by step progress toward being able to run my study. And if I can, I'd like to be using the up-to-date version of OS, with all the built-ins doing their job!

    Thanks for your patience,

    Russell

  • Heya!

    That error stems from not getting in any samples during a noise calibration, and thus having Xvar be 0. I should add a check to the code to see if any have come in, and if not to not divide by a len of 0.

    You can monkey-patch this in your own package quickly by changing that line to:

    if len(Xvar) > 1:
        XRMS = (sum(Xvar) / len(Xvar))**0.5
    else:
        XRMS = 0
    

    You'd have to do the same for YRMS.

    Cheers,

    Edwin

Sign In or Register to comment.