Results 1 to 7 of 7

Thread: Need good Winsock tutorial

  1. #1

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Arrow Need good Winsock tutorial

    anyone ?
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Need good Winsock tutorial

    Browse around vbip.com. They have many tutorials on the Winsock control.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Need good Winsock tutorial

    Here are a couple

    Winsock
    Winsock Tutorial

  4. #4

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Need good Winsock tutorial

    Thanks.
    Another questions,

    Does Winsock freezes (like URLDownloadToFile or Inet control) when you try to connect to a http site but there is no internet connection present ?
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Need good Winsock tutorial

    Quote Originally Posted by iPrank
    Thanks.
    Another questions,

    Does Winsock freezes (like URLDownloadToFile or Inet control) when you try to connect to a http site but there is no internet connection present ?
    if you dont create some code in the WS_Error event, then yes it will create the effect that your socket has frozen even though it actually has returned an error, so have something like this
    VB Code:
    1. Private Sub Winsock182_Error(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)
    2.     Winsock182.Close
    3.     MsgBox "Error (" & Number & "): " & Description, vbCritical, "Socket Error"
    4. End Sub

    this will give a msgbox saying the err num+description such as

    ---------------------------
    Socket Error
    ---------------------------
    Error (11001): Authoritative answer: Host not found
    ---------------------------
    OK
    ---------------------------

    best winsock site ever is www.winsockvb.com that is literally all you need, tuts for everything from basic chat to multi threaded downloads
    Chris

  6. #6
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Need good Winsock tutorial

    ...just a little heads up for using winsock:

    never ever do this as many do:

    VB Code:
    1. Private Sub Winsock1_Close()
    2.     MsgBox "Connection closed"
    3. End Sub
    you will be trapped forever until the end of time in a looping msgbox!

    always use Close method before displaying the msgbox like

    VB Code:
    1. Private Sub Winsock1_Close()
    2.     Winsock182.Close
    3.     MsgBox "Connection closed"
    4. End Sub

    BTW the close event fires when the remote host terminates the connection
    Chris

  7. #7

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Need good Winsock tutorial

    Thanks everybody.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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