Results 1 to 13 of 13

Thread: Winsock

  1. #1

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17

    Winsock

    I have a problem and hope someone can help.

    when I run this code I cant connect to a server, I just get a error
    message returned:

    The attempt to connect timed out
    or
    Authoritive answer: Host not found

    I've tried several irc servers but always get an error.

    Can someone tell me what is wrong with this code?

    I'm new to winsock and have been getting code from various
    places but nothing seems to work and I cant find any decent help
    with my problem.


    Code:
    Private Sub Command1_Click()
    
    Winsock1(0).SendData Text1.Text & vbCrLf
    End Sub
    
    Private Sub Command2_Click()
    Dim RemHost As String
    Dim RemPort As Integer
    Dim HostName As String
    RemHost = Text2.Text
    RemPort = Text3.Text
    HostName = Text4.Text
    
    List3.AddItem "***Connecting..."
    Winsock1(0).Connect RemHost, RemPort
    
    End Sub
    
    Private Sub Command3_Click()
    Winsock1(0).Close
    List3.AddItem "***Disconnected."
    End Sub
    
    
    Private Sub Winsock1_Connect(Index As Integer)
    List3.AddItem "***Connected!", vbInformation
    ' Introduce ourselves to the IRC server. Our nickname will be "WVB_Test"
        With Winsock1(0)
            .SendData "NICK WVB_Test" & vbCrLf
            .SendData "USER WVB_Test " & Winsock1(0).LocalHostName & " " & _
                    UCase(Winsock1(0).LocalHostName & ":" & Winsock1(0).LocalPort & "/0") & _
                " :WinsockVB Test Client" & vbCrLf
        End With
    End Sub
    
    
    
    Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    Dim strBuff As String
        Winsock1(0).GetData strBuff, vbString
        List3.AddItem vbCrLf & strBuff, vbInformation
    End Sub
    
    Private Sub Winsock1_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    List3.AddItem "***Error occured : (" & Scode & ":" & Description & ")"
    Winsock1(0).Close
    List3.AddItem "***Connection Closed."
    End Sub

    Any ideas/help would be great, thanks.
    --------------------
    Almost as much goodness as a tramps pants.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    In Command2_Click() can you MsgBox RemHost and RemPort.
    The IRC Servers you're trying to connect to may no longer exist.

    The error : "Authoritive answer: Host not found" is a DNS error.
    Basically an authoritive DNS server is telling you that it could not find that hostname in its list of DNS entries.

    Try ircnet.demon.co.uk or efnet.demon.co.uk
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17
    Thanks for the reply!

    i've tryed many servers including ircnet.demon.co.uk and efnet.demon.co.uk and i've tried connecting to thier ips but I'm still getting the same problems.

    I'm using a college computer, could that be a reason? some kind of restrictions?

    I'm also getting the error:
    The attept to connect timed out.

    what to you mean:

    In Command2_Click() can you MsgBox RemHost and RemPort
    msgbox remhost & remport ?
    --------------------
    Almost as much goodness as a tramps pants.

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Just MsgBox the variables to make sure you're pulling the correct strings.
    If its inside a college, then you may have a proxy server to get through.

    That proxy probably handles DNS requests itself, and as such, any other DNS servers inside your LAN would probably only serve DNS and WINS requests locally only.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17
    i'm getting the correct strings in the msgbox so thats ok.

    As for the proxy, any ideas/sites/code on how to get past it?

    Thanks.
    --------------------
    Almost as much goodness as a tramps pants.

  6. #6
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    What os you running ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  7. #7

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17
    win2k pro
    --------------------
    Almost as much goodness as a tramps pants.

  8. #8
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Do :

    Start > run > cmd
    Then do : ipconfig

    Do you have DNS server addresses listed ?


    Then right click on internet explorer, go into properties, go into connections, check the proxy settings.
    Is the browser getting the settings from a URL, or do you have proxy addresses in there ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  9. #9

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17
    theres a few ip addresses:

    Ip Address...
    Subnet Mask...
    Default Gateway...

    There are no proxy addresses.
    --------------------
    Almost as much goodness as a tramps pants.

  10. #10
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Okay, try doing a traceroute.

    Start > Run > cmd

    tracert www.vbforums.com

    Does the trace get outside your network ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  11. #11

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17
    it went through a few different addresses/ips but I cant see vbforums on the list.
    --------------------
    Almost as much goodness as a tramps pants.

  12. #12
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Did it get outside of your network though ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  13. #13

    Thread Starter
    Junior Member Dr_Gonzo's Avatar
    Join Date
    Jan 2003
    Location
    Derby, UK
    Posts
    17
    sorry, yea.
    --------------------
    Almost as much goodness as a tramps pants.

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