Please READ
Hy ... I was trying to implement a class that inherited the AxMSWinsockLib.Winsock activex, but i have some problems handling the events ... I tryied the following code:
It seams to handle the Error and the Connect Event, but it doesnt handle the DataArrival event ... Is there something wrong with my code ? I would appreciate some help ... Thanks in advance!
Hy ... I was trying to implement a class that inherited the AxMSWinsockLib.Winsock activex, but i have some problems handling the events ... I tryied the following code:
Code:
Public Class Socket
Inherits AxMSWinsockLib.AxWinsock
Public Sub New()
MyBase.New()
MyBase.CreateControl()
End Sub
Private Sub EventHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.ConnectEvent
sender.SendData("USER " & sender.Tag & vbCrLf)
sender.Senddata("PASS sanatate" & vbCrLf)
End Sub
Public Sub arrive(ByVal sender As System.Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles MyBase.DataArrival
Dim data As String
sender.GetData(data)
MsgBox("Data has arrived!")
If InStr("230", data) Then
MsgBox("Logged in!")
sender.SendData("BYE" & vbCrLf)
sender.Close()
ElseIf InStr("530", data) Then
MsgBox("Loggin incorrect")
sender.SendData("BYE" & vbCrLf)
sender.Close()
End If
End Sub
Private Sub ErrHandler(ByVal sender As System.Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_ErrorEvent) Handles MyBase.Error
MsgBox(e.description)
MyBase.Close()
End Sub
End Class
It seams to handle the Error and the Connect Event, but it doesnt handle the DataArrival event ... Is there something wrong with my code ? I would appreciate some help ... Thanks in advance!