Open() public method

Open a socket and connects to the plc, sending all the corrected package and returning if the connection was successful (ErroreCode.NoError) of it was wrong.
public Open ( ) : ErrorCode
return ErrorCode
Beispiel #1
0
 /// <summary>
 /// Create a plc that will connect to localhost (Snap 7 server) and connect to it
 /// </summary>
 public S7NetTests()
 {
     plc = new Plc(CpuType.S7300, "127.0.0.1", 0, 2);
     //ConsoleManager.Show();
     ShutDownServiceS7oiehsx64();
     S7TestServer.Start();
     plc.Open();
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            S7.Net.Plc plc     = new Plc(cpu: CpuType.S71200, ip: "10.1.10.142", rack: 0, slot: 1);
            ErrorCode  errCode = plc.Open();

            var       b1    = (UInt16)plc.Read("MW100");
            ErrorCode write = plc.Write("MW102", 100);

            plc.Close();

            System.Console.WriteLine(b1);
            Console.ReadLine();
        }