本文整理匯總了VB.NET中System.Net.Sockets.TcpListener.Start方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET TcpListener.Start方法的具體用法?VB.NET TcpListener.Start怎麽用?VB.NET TcpListener.Start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Net.Sockets.TcpListener
的用法示例。
在下文中一共展示了TcpListener.Start方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DoStart
Public Shared Sub DoStart(t As TcpListener, backlog As Integer)
' Start listening for client connections with the
' specified backlog.
t.Start(backlog)
Console.WriteLine("started listening")
End Sub
示例2: TcpListener.Start()
' 導入命名空間
Imports System.Net.Sockets
Imports System.Net
Imports System.Threading
Imports System.Text
Public Class Tester
Dim Shared myTcpListener As TcpListener
Public Shared Sub Main
Dim myThread As New Thread(New ThreadStart(AddressOf StartListen))
myThread.Start()
End Sub
Private Shared Sub StartListen()
myTcpListener = New TcpListener(12334)
Dim blnConection As Boolean = False
Try
myTcpListener.Start()
Dim mySocket As Socket = myTcpListener.AcceptSocket()
Do
If mySocket.Connected = True Then blnConection = True
Loop Until blnConection = True
myTcpListener.Stop()
Catch ex As SocketException
Console.WriteLine(ex.Message)
End Try
End Sub
End Class