关于UDP 请教各位,我会用winsock的tcp方式编写一些小的程序,我想知道如何用udp编写,请问各位有没有什么好的源代码给我学习学习吗?多谢了:) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Option ExplicitPrivate Sub Command1_Click() Winsock1.Protocol = sckUDPProtocol Winsock1.RemoteHost = Text1.Text Winsock1.LocalPort = CLng(Text2.Text) Winsock1.RemotePort = CLng(Text3.Text) Winsock1.Bind Command1.Enabled = False Command2.Enabled = TrueEnd SubPrivate Sub Command2_Click() Winsock1.SendData "From A: " & Text4.Text Text4.Text = ""End SubPrivate Sub Form_Load() Label1.Caption = "远程IP" Label2.Caption = "远程连接端口" Label3.Caption = "近程连接端口" Label4.Caption = "信息" Command1.Caption = "连接" Command2.Caption = "送出信息" Command2.Enabled = False Text1.Text = "127.1" Text2.Text = "6666" Text3.Text = "7777" Text4.Text = "" Text5.Text = ""End SubPrivate Sub Winsock1_DataArrival(ByVal BytesTotal As Long) On Error GoTo Errors: Dim sVar As String Winsock1.GetData sVar, vbString Text5.Text = sVar & vbCrLf & Text5.Text Exit SubErrors:End Sub Option ExplicitPrivate Sub Command1_Click() Winsock1.Protocol = sckUDPProtocol Winsock1.RemoteHost = Text1.Text Winsock1.LocalPort = CLng(Text2.Text) Winsock1.RemotePort = CLng(Text3.Text) Winsock1.Bind Command1.Enabled = False Command2.Enabled = TrueEnd SubPrivate Sub Command2_Click() Winsock1.SendData "From B: " & Text4.Text Text4.Text = ""End SubPrivate Sub Form_Load() Label1.Caption = "远程IP" Label2.Caption = "远程连接端口" Label3.Caption = "近程连接端口" Label4.Caption = "信息" Command1.Caption = "连接" Command2.Caption = "送出信息" Command2.Enabled = False Text1.Text = "127.1" Text2.Text = "7777" Text3.Text = "6666" Text4.Text = "" Text5.Text = ""End SubPrivate Sub Winsock1_DataArrival(ByVal BytesTotal As Long) Dim sVar As String Winsock1.GetData sVar, vbString Text5.Text = sVar & vbCrLf & Text5.TextEnd Sub 再问各位高手!网上都有验证代理的软件,但是基本上都是验证http的代理的,请问有没有验证sock代理的源程序呢?这个验证sock代理的程序是不是基于winsock下的udp编写的呢? 参考http://community.csdn.net/Expert/topic/2723/2723148.xml?temp=.6528589 TRANSFORM 交叉表查询 网站疯掉了!顺便送分 终于做好了个人网站,散分.希望大家支持 中英对译问题 高分求好书!! 在SSTAB上动态增加控件,如果一页无法显示怎么办 请问一下,我在重先装系统后,原本做的VB程序,在运行的时候,会出现,"找不到工程或库",请问这是如何做呢??光标停在Trim()这个去空格函数中, 如何不通过WindowsList菜单激活指定的MDI子窗口? 帮助文件 怎样制作! 有没有一个属性是SSTAB控件最大化的? VB调用C++ 动态链接库 的问题 Spread的表头和列能不能去掉?
Winsock1.Protocol = sckUDPProtocol
Winsock1.RemoteHost = Text1.Text
Winsock1.LocalPort = CLng(Text2.Text)
Winsock1.RemotePort = CLng(Text3.Text)
Winsock1.Bind
Command1.Enabled = False
Command2.Enabled = True
End SubPrivate Sub Command2_Click()
Winsock1.SendData "From A: " & Text4.Text
Text4.Text = ""
End SubPrivate Sub Form_Load()
Label1.Caption = "远程IP"
Label2.Caption = "远程连接端口"
Label3.Caption = "近程连接端口"
Label4.Caption = "信息"
Command1.Caption = "连接"
Command2.Caption = "送出信息"
Command2.Enabled = False
Text1.Text = "127.1"
Text2.Text = "6666"
Text3.Text = "7777"
Text4.Text = ""
Text5.Text = ""End SubPrivate Sub Winsock1_DataArrival(ByVal BytesTotal As Long)
On Error GoTo Errors: Dim sVar As String
Winsock1.GetData sVar, vbString
Text5.Text = sVar & vbCrLf & Text5.Text
Exit SubErrors:End Sub
Winsock1.Protocol = sckUDPProtocol
Winsock1.RemoteHost = Text1.Text
Winsock1.LocalPort = CLng(Text2.Text)
Winsock1.RemotePort = CLng(Text3.Text)
Winsock1.Bind
Command1.Enabled = False
Command2.Enabled = True
End SubPrivate Sub Command2_Click()
Winsock1.SendData "From B: " & Text4.Text
Text4.Text = ""
End SubPrivate Sub Form_Load()
Label1.Caption = "远程IP"
Label2.Caption = "远程连接端口"
Label3.Caption = "近程连接端口"
Label4.Caption = "信息"
Command1.Caption = "连接"
Command2.Caption = "送出信息"
Command2.Enabled = False
Text1.Text = "127.1"
Text2.Text = "7777"
Text3.Text = "6666"
Text4.Text = ""
Text5.Text = ""End SubPrivate Sub Winsock1_DataArrival(ByVal BytesTotal As Long)
Dim sVar As String
Winsock1.GetData sVar, vbString
Text5.Text = sVar & vbCrLf & Text5.Text
End Sub
http://community.csdn.net/Expert/topic/2723/2723148.xml?temp=.6528589