VB.Net by API/System.Net.Sockets/ProtocolType

Материал из VB Эксперт
Перейти к: навигация, поиск

ProtocolType.Tcp

  

Imports System.Net.Sockets
Imports System.Net
Imports System.Threading

Public Class Tester
    Dim Shared mySocket As Socket
    Public Shared Sub Main
        Dim myThread As New Thread(New ThreadStart(AddressOf StartConnection))
        myThread.Start()

    End Sub
    Private Shared Sub StartConnection()
        Try
            mySocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
            mySocket.Connect(New IPEndPoint(IPAddress.Parse("192.168.1.100"), 12335))
        Catch ex As SocketException
            Console.WriteLine(ex.Message)
        End Try
    End Sub
    
End Class