//------------------------------------------------------------------------------ // Main //------------------------------------------------------------------------------ static void Main(string[] args) { // Get Progran args if (args.Length != 1) { Usage(); return; } // Create the PASSIVE partner Partner = new S7Partner(0); // Set the BRecv callback (using the static var to avoid the garbage collect) CallBack = new S7Partner.S7ParRecvCallback(RecvCallback); Partner.SetRecvCallback(CallBack, IntPtr.Zero); // Start int Error=Partner.StartTo("0.0.0.0", args[0], 0x1002, 0x1002); if (Error == 0) Console.WriteLine("Passive partner started"); else Console.WriteLine(Partner.ErrorText(Error)); // If you got a start error: // Windows - most likely you ar running the server in a pc on wich is // installed step 7 : open a command prompt and type // "net stop s7oiehsx" (Win32) or // "net stop s7oiehsx64" (Win64) // And after this test : // "net start s7oiehsx" (Win32) or // "net start s7oiehsx64" (Win64) // Unix - you need root rights :-( because the isotcp port (102) is // low and so it's considered "privileged". Console.ReadKey(); Partner.Stop(); }