Hi,

I have below code which have no error. but after clicking the button it winsock closed automatically and i will not able to connect on winsock via telnet.

Code:
Private Sub Command2_Click()
 Dim tcpMailSocket As Object
 Set tcpMailSocket = CreateObject("MSWinsock.Winsock")
    If tcpMailSocket.State <> 2 Then
    tcpMailSocket.Protocol = sckTCPProtocol
    tcpMailSocket.Listen
    End If
    Text1.Text = tcpMailSocket.LocalPort
End Sub
Could you please point how to keep listening Winsock using CreateObjet?
Same code when i use Winsock.ocx component it works well.

BR