Hi,
I have a program that accepts a connection by typing the following address in a web browser:
http://localhost:<port>/quotes/<parameter>
It produces a simple text-file displayed in the browser. Now.. I want to replicate this request from my VB program, and get the same text back as a string. Actually I'm able to do that, by the following code:
Then I try to send a query:Code:Private _client as New TcpClient _client.Connect(localhost, port)
SendData("GET /quotes/<parameter>")
So... I get actually the response.. but it takes like 45 seconds.. While in the browser it's instant. Is this perhaps because I connect and send the response separately? How do I send a connection request with the message in the same request? I guess also this connection needs to be closed after each request? At least I'm only able to get one response with my program, then I must restart it.Code:Public Sub SendData(ByVal str As String) Dim writer As New IO.StreamWriter(_client.GetStream) writer.Write(str & vbCr) writer.Flush() End Sub
Btw.. the response I get looks like this,:
And of course... If possible, i don't want the response coded as html...Code:HTTP/1.0 200 OK Date: Thu, 08 Apr 2010 20:43:41 GMT Server: NfTinyHTTP 0.1 Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: Thu, 08 Apr 2010 20:43:41 GMT Cache-Control: no-cache, must-revalidate Pragma: no-cache Content-type: text/html <body><html><table> <tr><td>SEQUENCE</td> <td>EXCHANGE</td> <td>BOARD</td> <td>TIME</td> <td>PAPER</td> <td>BID</td> <td>BID-DEPTH</td> <td>BID-DEPTH-TOTAL</td> <td>BID-NUMBER</td> <td>OFFER</td> <td>OFFER-DEPTH</td> <td>OFFER-DEPTH-TOTAL</td> <td>OFFER-N
.




Reply With Quote