UDP连接入门
Private Sub Form_Load() ' The control's name is udpPeerA With udpPeerA ' IMPORTANT: be sure to change the RemoteHost ' value to the name of your computer. .RemoteHost= "PeerB" .RemotePort = 1001 ' Port to connect to. .Bind 1002 ' Bind to the local port. End With frmPeerB.Show ' Show the second form. End Sub Private Sub txtSend_Change() ' Send text as soon as it's typed. udpPeerA.SendData txtSend.Text End Sub Private Sub udpPeerA_DataArrival _ (ByVal bytesTotal As Long) Dim strData As String udpPeerA.GetData strData txtOutput.Text = strData End Sub |
Private Sub Form_Load() ' The control's name is udpPeerB. With udpPeerB ' IMPORTANT: be sure to change the RemoteHost ' value to the name of your computer. .RemoteHost= "PeerA" .RemotePort = 1002 ' Port to connect to. .Bind 1001 ' Bind to the local port. End With End Sub Private Sub txtSend_Change() ' Send text as soon as it's typed. udpPeerB.SendData txtSend.Text End Sub Private Sub udpPeerB_DataArrival _ (ByVal bytesTotal As Long) Dim strData As String udpPeerB.GetData strData txtOutput.Text = strData End Sub |
欢迎访问最专业的网吧论坛,无盘论坛,网吧经营,网咖管理,网吧专业论坛
https://bbs.txwb.com
关注天下网吧微信/下载天下网吧APP/天下网吧小程序,一起来超精彩
|
本文来源:BLOG 作者:佚名