mycroes / Sally7

C# implementation of Siemens S7 connections with a focus on performance
MIT License
56 stars 22 forks source link

Editable S7 Port #18

Closed mach-sfortier closed 1 year ago

mach-sfortier commented 3 years ago

Modification to allow changing the default port 102.

For purpose where more than one S7 server are started on a station with different S7 listening port.

mycroes commented 3 years ago

Hi @mach-sfortier, can you tell me how this works on the PLC side? I'm not a PLC programmer, but I never heard any of the PLC programmers at our company say anything about port numbers (they actually ask me instead...). I'd be willing to merge this if it makes sense in the scheme of Siemens PLC's, if it's only here because it's theoretically possible (port forwarding, software stations) I'm not sure if I want it to take such a prominent place. Please let me know, either I can merge it as is or find another way that at least allows one to change the port.

mach-sfortier commented 3 years ago

Hi @mycroes,

This modification isn't for Siemens PLC's. It's more to use Sally7 with the simulation of multiple Siemens PLC on a computer with only one network card available. In this case, the simulated Siemens PLC will be started with different port.

Best regards, Stéphane

scamille commented 3 years ago

I guess you could also always imagine a scenario where the network does something to map the true port to a different one, for whatever reasons.

The S7NetPlus library allows for adjusting the port exactly because of the Snap7 unit tests, which don't run on non windows systems without special privileges on low ports.

That works fine there, so it should work here as well.