In order to get information from a printer, it requires a Post with an XML , wait for the valid reply and then Get command on the same connection to get the values.
I use HTTPSocket asynchronous to do this,
and the Post works: the printer replies with status code 200 (which is supposed to happen).
But when I then use the same connection (that wa slept alive) to Get the result of my query placed in the Post,
I get a 409 Conflict in the response header.
I know this means the HTTP POST and HTTP GET are not paired, but I don’t know how to fix this.
Any suggestions?
[code]Replied=false
dim f as FolderItem
f= App.ExecutableFile.Parent.parent.child(“Resources”).child(“cmd.xml”)
dim s as text
dim l as string
dim t as TextInputStream
if f<>nil then
t=TextInputStream.Open(f)
t.Encoding=Encodings.UTF8
s=t.ReadAll.ToText
l=str(len(s))
end
dim URL as string
URL=URLField.text
MySocket.ClearRequestHeaders
MySocket.SetRequestHeader(“Host”,“10.0.1.82”)
MySocket.SetRequestHeader(“Content-Type”,“application/octet-stream”)
MySocket.SetRequestHeader(“Content-Length”,l.ToText)
MySocket.SetRequestHeader(“Connection”,“Keep-Alive”)
MySocket.SetRequestContent(s,“application/octet-stream”)
system.DebugLog “request about to be sent”
MySocket.SendRequest(“POST”, URL)
while replied=false // Pagereceived event sets replied to True
app.DoEvents // I know this is not very nice coding, but it works
wend
replied=false
system.DebugLog “Getting reply…”
MySocket.ClearRequestHeaders
MySocket.SetRequestHeader(“Host”,“10.0.1.82”)
MySocket.SetRequestHeader(“Connection”,“Keep-Alive”)
MySocket.SendRequest(“GET”,URL)
while replied=false
app.DoEvents
wend
MySocket.Disconnect
System.DebugLog “Diconnected”
[/code]