<p>I posted the issue to the <a href="https://discourse.psychopy.org/t/psychopy-to-egi-netstation-connection-error/5396/4" rel="nofollow noreferrer">PsychoPy forum</a> already, but was wondering if I could get more input from StackExchange. </p>

<p>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!</p>

<p>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.</p>

<pre><code>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?
</code></pre>

<p>And I get the following error:</p>

<pre><code>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'
</code></pre>

<p>So summarizing my question,</p>

<ol>
<li><p>Is it correct that I am supposed to input the IPv4 address of the NetStation machine?</p></li>
<li><p>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?</p></li>
<li><p>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?</p></li>
</ol>

<p>Thank you. Any help or pointers would be appreciated!</p>

CC BY-SA 4.0
2018-09-25T09:00:09.817Z
I think a specific question like this is more suitable for the PsychoPi forum and your [duplicate question there](https://discourse.psychopy.org/t/psychopy-to-egi-netstation-connection-error/5396/4) has four replies. Personally, I do not post any questions on the MATLAB PsychToolbox here either; as the respective forum is more suitable for these kinds of specifics. I went over to Bio Informatics SE and they regard your question as offtopic there, so migration is not an option. It will likely not be answered here either. Would you mind if this question is closed?
AliceD
CC BY-SA 4.0
2018-09-25T14:51:45.237Z
@AliceD Yes, it's alright. I was hoping I could get more input from here too. Thanks!
Vinci
CC BY-SA 4.0
2018-09-25T15:05:07.557Z
I'll through this issue on meta as well before closing. It's a well researched question and the topic is great, it's just very specific. Thanks for your understanding.
AliceD
CC BY-SA 4.0
2018-09-29T07:35:21.813Z
@AliceD how about [scicomp.se]?
Ooker
CC BY-SA 4.0
2018-09-29T07:46:53.923Z
@Ooker wow thanks for the pointer! I'll head over to their chat once I have my hands free. Thanks!
AliceD
CC BY-SA 4.0
2018-09-29T07:53:21.240Z
@AliceD can't believe you don't know about this yet @@. See also in the mother meta: [Which community should a biophysics question belong to?](https://meta.stackexchange.com/q/231938/260800)
Ooker
<eeg>
Connection problem with PsychoPy to EGI netstation for EEG experiment
Vinci
# Connection problem with PsychoPy to EGI netstation for EEG experiment

(Asked by: username_0 on 2018-09-24)

I posted the issue to the PsychoPy forum already, but was wondering if I could get more input from StackExchange. 
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!

**Tags:** eeg

> **Comments:**
> **username_1**: I think a specific question like this is more suitable for the PsychoPi forum and your [duplicate question there](https://discourse.psychopy.org/t/psychopy-to-egi-netstation-connection-error/5396/4) has four replies. Personally, I do not post any questions on the MATLAB PsychToolbox here either; as the respective forum is more suitable for these kinds of specifics. I went over to Bio Informatics SE and they regard your question as offtopic there, so migration is not an option. It will likely not be answered here either. Would you mind if this question is closed?  
> **username_0**: @username_1 Yes, it's alright. I was hoping I could get more input from here too. Thanks!  
> **username_1**: I'll through this issue on meta as well before closing. It's a well researched question and the topic is great, it's just very specific. Thanks for your understanding.  
> **username_2**: @username_1 how about [scicomp.se]?  
> **username_1**: @username_2 wow thanks for the pointer! I'll head over to their chat once I have my hands free. Thanks!  
> **username_2**: @username_1 can't believe you don't know about this yet @@. See also in the mother meta: [Which community should a biophysics question belong to?](https://meta.stackexchange.com/q/231938/260800)  

---

## 0 answers

