4 个解决方案
#1
你添加之后在工具箱中没有吗?
#2
没有呀?我没找到?是哪个控件?指点一下好吗?
#3
老兄,已经没有这个控件了!!!!要自己New 一个Scoket类了!!!
哎!该死的微软!!!
Dim lipa As IPHostEntry = Dns.Resolve("host.contoso.com")
Dim lep As New IPEndPoint(lipa.AddressList(0), 11000)
Dim s As New Socket(lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Try
s.Connect(lep)
Catch e As Exception
Console.WriteLine(("Exception Thrown: " + e.ToString()))
End Try
Dim msg As Byte() = Encoding.ASCII.GetBytes("This is a test")
' Blocks until send returns.
Dim i As Integer = s.Send(msg, 0, msg.Length, SocketFlags.None)
' Blocks until read returns.
Dim bytes(1024) As Byte
s.Receive(bytes, 0, s.Available, SocketFlags.None)
'Displays to the screen.
Console.WriteLine(Encoding.ASCII.GetString(bytes))
s.Shutdown(SocketShutdown.Both)
s.Close()
End Sub 'SendReceive4
哎!该死的微软!!!
Dim lipa As IPHostEntry = Dns.Resolve("host.contoso.com")
Dim lep As New IPEndPoint(lipa.AddressList(0), 11000)
Dim s As New Socket(lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Try
s.Connect(lep)
Catch e As Exception
Console.WriteLine(("Exception Thrown: " + e.ToString()))
End Try
Dim msg As Byte() = Encoding.ASCII.GetBytes("This is a test")
' Blocks until send returns.
Dim i As Integer = s.Send(msg, 0, msg.Length, SocketFlags.None)
' Blocks until read returns.
Dim bytes(1024) As Byte
s.Receive(bytes, 0, s.Available, SocketFlags.None)
'Displays to the screen.
Console.WriteLine(Encoding.ASCII.GetString(bytes))
s.Shutdown(SocketShutdown.Both)
s.Close()
End Sub 'SendReceive4
#4
在工具箱里点右键添加控件,从COM选项卡里找,会有的,有可能不能往窗体上拖放,直接在代码里生成对象把
#1
你添加之后在工具箱中没有吗?
#2
没有呀?我没找到?是哪个控件?指点一下好吗?
#3
老兄,已经没有这个控件了!!!!要自己New 一个Scoket类了!!!
哎!该死的微软!!!
Dim lipa As IPHostEntry = Dns.Resolve("host.contoso.com")
Dim lep As New IPEndPoint(lipa.AddressList(0), 11000)
Dim s As New Socket(lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Try
s.Connect(lep)
Catch e As Exception
Console.WriteLine(("Exception Thrown: " + e.ToString()))
End Try
Dim msg As Byte() = Encoding.ASCII.GetBytes("This is a test")
' Blocks until send returns.
Dim i As Integer = s.Send(msg, 0, msg.Length, SocketFlags.None)
' Blocks until read returns.
Dim bytes(1024) As Byte
s.Receive(bytes, 0, s.Available, SocketFlags.None)
'Displays to the screen.
Console.WriteLine(Encoding.ASCII.GetString(bytes))
s.Shutdown(SocketShutdown.Both)
s.Close()
End Sub 'SendReceive4
哎!该死的微软!!!
Dim lipa As IPHostEntry = Dns.Resolve("host.contoso.com")
Dim lep As New IPEndPoint(lipa.AddressList(0), 11000)
Dim s As New Socket(lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Try
s.Connect(lep)
Catch e As Exception
Console.WriteLine(("Exception Thrown: " + e.ToString()))
End Try
Dim msg As Byte() = Encoding.ASCII.GetBytes("This is a test")
' Blocks until send returns.
Dim i As Integer = s.Send(msg, 0, msg.Length, SocketFlags.None)
' Blocks until read returns.
Dim bytes(1024) As Byte
s.Receive(bytes, 0, s.Available, SocketFlags.None)
'Displays to the screen.
Console.WriteLine(Encoding.ASCII.GetString(bytes))
s.Shutdown(SocketShutdown.Both)
s.Close()
End Sub 'SendReceive4
#4
在工具箱里点右键添加控件,从COM选项卡里找,会有的,有可能不能往窗体上拖放,直接在代码里生成对象把