Results 1 to 6 of 6

Thread: [RESOLVED] How to replicate this request?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    185

    Resolved [RESOLVED] How to replicate this request?

    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:

    Code:
    Private _client as New TcpClient
    _client.Connect(localhost, port)
    Then I try to send a query:

    SendData("GET /quotes/<parameter>")

    Code:
      
    Public Sub SendData(ByVal str As String)
            Dim writer As New IO.StreamWriter(_client.GetStream)
            writer.Write(str & vbCr)
            writer.Flush()
        End Sub
    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.


    Btw.. the response I get looks like this,:
    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
    And of course... If possible, i don't want the response coded as html...
    .
    Last edited by bretddog; Apr 8th, 2010 at 04:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width