[英]TCP can't connect to localserver
我在 Visual Basic 中遇到 TCP 問題,因為我收到以下錯誤:
“發送”不是“System.Net.Sockets.TcpClient”的成員。 C:\\Users\\Nathan\\Desktop\\Launcher\\WindowsApplication1\\WindowsApplication1\\Elite Team Launcher.vb 56 21 WindowsApplication1
這是代碼:
Dim client As New TcpClient
client.Connect("192.168.1.103", 7775)
Dim sendbytes() As Byte = System.Text.Encoding.ASCII.GetBytes(TextBox1.Text)
client.Send(sendbytes, 0, sendbytes.Length)
不要使用Send
。 您需要在從GetStream
返回的Stream
上改用Write
。
您可以在此處查看如何正確使用TcpClient
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.