bparzella / secsgem

Simple Python SECS/GEM implementation
GNU Lesser General Public License v2.1
177 stars 85 forks source link

Testing samples/gem_host.py and samples/gem_equipment.py #134

Open twmr opened 6 months ago

twmr commented 6 months ago

Hi! Thx a lot for this great library!

I'm curious if the host and equipment examples in the samples/ dir can be run on the same host to test basic streaming functions.

What I currently get when I run both samples on the same host is an Address already in use exception in the sample that is started last. This is with secsgem v0.1.0 (BTW With the version from the main branch I get different exceptions).

RDerber commented 3 weeks ago

In order to run both the host and equipment examples in the sampled dir you will have to redirect both of them to different, unused ports. To have the host and equipment communicate with each other, you will need to mutually forward the ports to one another.

I altered the settings settings in gem_host.py to point to port=5001, and equipment_host.py to port=5002. On a windows machine I then forwarded the ports to one another with: netsh interface portproxy add v4tov4 listenport=5001 listenaddress=127.0.0.1 connectport=5002 connectaddress=127.0.0.1 netsh interface portproxy add v4tov4 listenport=5002 listenaddress=127.0.0.1 connectport=5001 connectaddress=127.0.0.1