在服务器 - 客户端程序中启动服务器时出错

时间:2017-03-20 14:30:55

标签: vb.net tcp tcpclient

我在Visual Studio 2015中处理服务器客户端程序。这里我得到一个错误,说明socketException未处理。错误在'Server.Start()'附近。其余的代码没有显示任何错误,因此没有发布。

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

Public Class TCPControl
Public Event MessageReceived(sender As TCPControl, Data As String)

' SERVER CONFIG
Public ServerIP As IPAddress = IPAddress.Parse("10.0.0.253")
Public ServerPort As Integer = 64555
Public Server As TcpListener

Private CommThread As Thread
Public IsListening As Boolean = True

' CLIENTS
Private Client As TcpClient
Private ClientData As StreamReader

Public Sub New()
    Server = New TcpListener(ServerIP, ServerPort)
    Server.Start()

    CommThread = New Thread(New ThreadStart(AddressOf Listening))
    CommThread.Start()
End Sub

0 个答案:

没有答案