Results 1 to 4 of 4

Thread: what's the difference between "host" and" .RemoteHost "

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    4

    what's the difference between "host" and" .RemoteHost "

    HI,everybuddy

    When I use winsock, I can't understand what's the difference between ".RemoteHost" & "Host"?

    ---------------------------------------------------

    Private Sub Command1_Click()
    With Winsock1
    .Close
    .RemoteHost = "www.vbfirums.com" ''''''''''''''''''here
    .RemotePort = 80
    .Connect
    End With

    End Sub

    Private Sub Winsock1_Connect()

    Dim s As String
    s = "GET / HTTP/1.0" + vbCrLf
    s = s + "Accept: */*" + vbCrLf
    s = s + "Accept -Encoding: gzip , deflate" + vbCrLf
    s = s & "Pragma: no-cache" & vbCrLf
    s = s & "Cache-Control: no-cache" & vbCrLf
    s = s & "Host: www.vbfirums.com" ''''''''''''''''''here
    s = s + vbCrLf
    Winsock1.SendData s
    End Sub


    -----------------------------------------

    Why need I define "Host" again after I define "RemoteHost" while I "open" this sock?

    can I just ignore the 2nd one?

    thanks

  2. #2
    Junior Member
    Join Date
    May 2005
    Location
    California
    Posts
    22

    Re: what's the difference between "host" and" .RemoteHost "

    No, you can't ignore it. That second part of your code is a collection of HTTP request headers, and the Host header field identifies the server that you want to connect to. This is important because a lot of webservers are configured to support multiple virtual hosts.

    For example, one server could be configured to return pages for www.foo.com and www.bar.com, with both of those host names configured in DNS to return the same IP address. That's how most cheap web hosting companies work; hundreds of domains can be served from the same server, using the same IP address. Because the IP address is shared, the only way that the server knows what pages you really want is based on the hostname that's provided in that header field.

    By the way, I'd also get rid of the "Accept-Encoding: gzip , deflate" line there unless your program is really prepared to accept a compressed data stream. My guess is that you're not.
    Mike Stefanik
    sockettools.com

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    4

    Re: what's the difference between "host" and" .RemoteHost "

    Thank a lot!

  4. #4
    New Member
    Join Date
    Mar 2006
    Posts
    13

    Re: what's the difference between "host" and" .RemoteHost "

    Using my code you could accept gzip, deflate compressed data.
    It would speed up the transfer.

    Check out this post.

    http://www.vbforums.com/showthread.php?t=396509

    idolpx
    There are only 10 types of people in the world. Those who know binary and those who don't.
    Want to see my VB Expert Rating?

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