I posted the issue last week, but came back with clearer question. So I’m having difficulty establishing connection between the Psychopy running testing machine and the machine with the actual netstation installed. I numbered the summary questions at bottom!
I have the basic following code below, but I’m assuming I am inputting a wrong IPv4 address or port number for the net station.
from __future__ import absolute_import, division, print_function from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED, STOPPED, FINISHED, PRESSED, RELEASED, FOREVER) import numpy as np # whole numpy lib is available, prepend 'np.' from numpy import (sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray) from numpy.random import random, randint, normal, shuffle import os # handy system and path functions import sys # to get file system encoding # Setup for EGI import egi.simple as egi # for testing purposes #import egi.simple as egi ms_localtime = egi.ms_localtime # gives local time in ms ns = egi.Netstation() ns.connect('ipv4 address of the testingmachine ', 'port number of netstation machine') # change/ check by Network Utility?
And I get the following error:
File "/Users/abc/Documents/PsychoPy/cfv/cfv_egi.py", line 281, in ns.BeginSession() File "/Users/abc/Documents/PsychoPy/cfv/egi/simple.py", line 799, in BeginSession self._socket.write( message ) File "/Users/abc/Documents/PsychoPy/cfv/egi/socket_wrapper.py", line 58, in write self._connection.write( data ) AttributeError: Socket instance has no attribute '_connection' 6.9777 WARNING
When I change the port to another one with a server, it gives me the below:
Traceback (most recent call last): File "/Users/abc/Documents/PsychoPy/cfv/cfv_egi.py", line 281, in ns.BeginSession() File "/Users/abc/Documents/PsychoPy/cfv/egi/simple.py", line 804, in BeginSession return self.GetServerResponse() File "/Users/abc/Documents/PsychoPy/cfv/egi/simple.py", line 783, in GetServerResponse raise Eggog( "unexpected character code returned from server: '%s'" % (code, ) ) egi.simple.Eggog: unexpected character code returned from server: 'R'
So summarizing my question,
- Is it correct that I am supposed to input the IPv4 address of the NetStation machine?
- how do I figure out what port number I need to input? Do I use the port numbers listed from using “Network Utility” app in the mac?
- When running the psychopy code that makes me connect to the machine, what needs to be setup in the Netstation computer? ie. do I need to have netstation software running?
Thank you. Any help or pointers would be appreciated!