Autor Beitrag
bo_91
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 43

Win XP - Win8
C#, PHP, VB, Java
BeitragVerfasst: Mi 26.10.11 17:08 
Hallo,

Ich versuche mittels HttpWebRequest eine Steckdosenleiste zu steuern. Aus der Anleitung habe ich die Kommunikationsdetails entnommen..

Manual des Geräts, Seite 20
www.koukaam.se/kouka..._NETIO-230B_3-00.pdf

Wenn ich als URI "http://192.168.1.21" abrufe bekomme ich den HTML Code zurück. -> Alles gut. (Login für die GUI Steuerung)
bei "http://192.168.1.21/tgi/control.tgi?hash=hash" bekomme ich die Exception "Der Server hat eine Protokollverletzung ausgeführt.. Section=ResponseStatusLine" (Zeile 7)

Wenn ich dies im Browser eingebe bekomme ich den Hash string angezeigt welchen ich später für das sichere Login benötige.

Nun was mache ich in meinem Code falsch?

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
StringBuilder sb = new StringBuilder();

byte[] buf = new byte[1024];

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://192.168.1.21/tgi/control.tgi?hash=hash");

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Stream resStream = response.GetResponseStream();

string tempString = null;
int count = 0;

do
{
    count = resStream.Read(buf, 0, buf.Length);

    if (count != 0)
    {
        tempString = Encoding.ASCII.GetString(buf, 0, count);
        sb.Append(tempString);
    }
}
while (count > 0);

output.Text += sb.ToString();



mfg
Patrick
bo_91 Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 43

Win XP - Win8
C#, PHP, VB, Java
BeitragVerfasst: Do 27.10.11 15:36 
*schiiiiiieb*

nuun keiner eine Idee? braucht ihr weitere Infos? könnt ihr mir sagen wo ich weiter ansetzen soll?

bin für jede hilfe dankbar :)

mfg
bo91