Good morning,
I am converting the following code:
myRequest = (HttpWebRequest)WebRequest.Create(this.URL); // create request
myRequest.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(this.BasicAuthAccount + ":" + this.BasicAuthPassword)));
myRequest.Method = Method.ToString();
myRequest.KeepAlive = false;
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ReadWriteTimeout = 1000;
if (this.HasData)//Append data for send
{
byte[] byData = Encoding.ASCII.GetBytes(this.JsonifyString); // convert POST data to bytes
myRequest.ContentLength = byData.Length;
// Add the post data to the web request
outputStream = myRequest.GetRequestStream();
outputStream.Write(byData, 0, byData.Length);
outputStream.Close();
}
I think I use this Ignition method:
https://docs.inductiveautomation.com/display/DOC81/system.net.httpPut
And I came up with the following code:
url = "http://192.168.1.7/do_value/slot_0/ch_0"
contentType = "application/x-www-form-urlencoded"
putData = {"Ch":0, "Val": 0}
connectTimeout = 1000
readTimeout = 1000
username = "root"
password = "00000000"
system.net.httpPut(url, contentType, putData, connectTimeout, readTimeout, username, password)
And I packaged this code into an Ignition button script and am getting the following error:
Traceback (most recent call last):
File "<event:actionPerformed>", line 10, in <module>
IOError: Unexpected end of file from server
Does anyone know what this error means?