# Sending triggers to NetStation - Error 10051: "A socket operation was attempted to an unreachable network"

**URL:** <https://discourse.psychopy.org/t/sending-triggers-to-netstation-error-10051-a-socket-operation-was-attempted-to-an-unreachable-network/29046>\
**Category:** Coding\
**Tags:** syntaxerror, code, python3, pavlovia, eeg\
**Created:** [May 8, 2022, 4:47pm UTC](https://discourse.psychopy.org/t/sending-triggers-to-netstation-error-10051-a-socket-operation-was-attempted-to-an-unreachable-network/29046 "2022-05-08T16:47:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ifetS](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@ifetS](https://discourse.psychopy.org/u/ifetS)\
**Post date:** [May 8, 2022, 4:47pm UTC](https://discourse.psychopy.org/t/sending-triggers-to-netstation-error-10051-a-socket-operation-was-attempted-to-an-unreachable-network/29046/1 "2022-05-08T16:47:45Z")

</div>

Continuing the discussion from [Egi library and python3](https://discourse.psychopy.org/t/egi-library-and-python3/6911/12):

Hi! I am stuck trying to establish a connection between the Psychopy stimulus presentation computer and the EEG recording computer (Mac) running EGI Netstation Acquisition.  
I have used the code suggested in GitHub by @gstothart as follows:

##set up connection  
from egi import simple as egi  
ms\_localtime = egi.ms\_localtime  
ns = egi.Netstation()  
ns.connect(‘10.10.10.42’, 53239) → my mac IP address and port address  
ns.BeginSession()  
ns.sync()  
ns.StartRecording()

##send trigger  
ns.sync()  
ns.SendSimpleTimestampEvent()

##close up NS  
ns.StopRecording()  
ns.EndSession()

However, I always get Error 10051: “A socket operation was attempted to an unreachable network”.

How can I work it out?

Many thanks

---

<div class="post-metadata">

**Author:** ![gstothart](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@gstothart](https://discourse.psychopy.org/u/gstothart)\
**Post date:** [May 25, 2022, 11:44am UTC](https://discourse.psychopy.org/t/sending-triggers-to-netstation-error-10051-a-socket-operation-was-attempted-to-an-unreachable-network/29046/2 "2022-05-25T11:44:07Z")

</div>

Hi, I have given up on EGI and bought a BrainProducts system instead, sorry I can’t be more help!  
George

---

<div class="post-metadata">

**Author:** ![Christophe\_Bossens](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/christophe_bossens/32/35415_2.png) [@Christophe\_Bossens](https://discourse.psychopy.org/u/Christophe_Bossens)\
**Post date:** [May 25, 2022, 1:44pm UTC](https://discourse.psychopy.org/t/sending-triggers-to-netstation-error-10051-a-socket-operation-was-attempted-to-an-unreachable-network/29046/3 "2022-05-25T13:44:10Z")

</div>

Can you try to execute the following in the command prompt (assuming Windows) on the stimulus computer:

`ping 10.10.10.42`

This would verify that your PsychoPy computer at least ‘sees’ the recording computer.

Have you done any special network configuration in addition to just executing the code that you mention? Usually for these computers to interact this way over a local network you need to configure the Ethernet connection explicitly (see [this](https://www.wikihow.com/Configure-Your-PC-to-a-Local-Area-Network) link). This would usually give an ip that looks like ‘192.168.x.x’.

I have no experience with the EGI Netstation so I might also totally be on the wrong track here 🙂

Best,  
Christophe

---

<div class="post-metadata">

**Author:** ![Anastasia\_Dimakou](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/anastasia_dimakou/32/36403_2.png) [@Anastasia\_Dimakou](https://discourse.psychopy.org/u/Anastasia_Dimakou)\
**Post date:** [January 10, 2023, 11:30am UTC](https://discourse.psychopy.org/t/sending-triggers-to-netstation-error-10051-a-socket-operation-was-attempted-to-an-unreachable-network/29046/4 "2023-01-10T11:30:41Z")

</div>

Hello Cristophe,

I am having the exact similar problem and I tried the ping 10.10.10.42 code and it seems that the transmit failes from the stimulus computer to the recording computer. But I do not have ethernet connection so I don’t know if this can create a problem as well. Any suggestion possible?

Thank you in advance,  
Ana
