EasyManua.ls Logo

Siemens SIMATIC MV500 - Page 210

Siemens SIMATIC MV500
294 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Process interfacing via an automation system (PLC, PC)
9.8 Remote client
SIMATIC MV500
210 Operating Instructions, 03/2021, C79000-G8976-C494-05
Pseudocode example
C# Pseudocode XML Backup
// Create new xml file
FileStream newXml = File.Open("C:\\mv400para.xml", FileMode.Create);
// Create http request
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://192.168.0.42/xml/backup.cg
i");
myRequest.Method = "GET";
myRequest.ContentLength = 0;
try
{
// Get response
HttpWebResponse myHttpWebResponse =
(HttpWebResponse)myRequest.GetResponse();
// Get response stream
Stream streamResponse = myHttpWebResponse.GetResponseStream();
// Read stream and write to file (stream == xml data)
byte[] readBuffer = new byte[256];
int count = streamResponse.Read(readBuffer, 0,
readBuffer.GetLength(0));
while (count > 0)
{
newXml.Write(readBuffer, 0, count);
count = streamResponse.Read(readBuffer, 0,
readBuffer.GetLength(0));
}
Console.WriteLine("XML backup succeeded.");
}
catch (System.Net.WebException we)
{
Console.WriteLine("NO PERMISSION FOR XML BACKUP!");
}

Table of Contents

Other manuals for Siemens SIMATIC MV500