anyone ?
Printable View
anyone ?
Browse around vbip.com. They have many tutorials on the Winsock control.
Here are a couple
Winsock
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 ?
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 thisQuote:
Originally Posted by iPrank
VB Code:
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) Winsock182.Close MsgBox "Error (" & Number & "): " & Description, vbCritical, "Socket Error" 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:thumb:
...just a little heads up for using winsock:
never ever do this as many do:
you will be trapped forever until the end of time in a looping msgbox!VB Code:
Private Sub Winsock1_Close() MsgBox "Connection closed" End Sub
always use Close method before displaying the msgbox like
VB Code:
Private Sub Winsock1_Close() Winsock182.Close MsgBox "Connection closed" End Sub
BTW the close event fires when the remote host terminates the connection
Thanks everybody. :)