通讯测试
本文最后更新时间:2009/03/18
简单的网络协议通讯测试工具,如果您对此工具感兴趣,请看下面源码:
- VERSION 5.00
- Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
- Begin VB.Form frmTest
- BorderStyle = 3 'Fixed Dialog
- Caption = "通讯测试"
- ClientHeight = 6000
- ClientLeft = 6180
- ClientTop = 1995
- ClientWidth = 5220
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6000
- ScaleWidth = 5220
- Begin VB.CommandButton cmdClose
- Caption = "关闭(&C)"
- Height = 345
- Left = 2310
- TabIndex = 5
- Top = 5610
- Width = 795
- End
- Begin VB.TextBox txtPort
- Height = 375
- Left = 1590
- TabIndex = 4
- Text = "80"
- Top = 5580
- Width = 615
- End
- Begin VB.TextBox txtIP
- Height = 345
- Left = 90
- TabIndex = 3
- Text = "127.0.0.1"
- Top = 5580
- Width = 1425
- End
- Begin VB.CommandButton cmdSend
- Caption = "发送(&S)"
- Height = 345
- Left = 3990
- TabIndex = 0
- Top = 5580
- Width = 1155
- End
- Begin VB.TextBox txtCommand
- Height = 1695
- Left = 90
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 2
- Text = "frmTest.frx":0000
- Top = 3810
- Width = 5055
- End
- Begin VB.TextBox txtInfo
- Height = 3615
- Left = 60
- Locked = -1 'True
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 1
- Top = 90
- Width = 5055
- End
- Begin MSWinsockLib.Winsock sckTest
- Left = 1380
- Top = 2160
- _ExtentX = 741
- _ExtentY = 741
- _Version = 393216
- End
- End
- Attribute VB_Name = "frmTest"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '--------------------------------------------------
- '
- ' 通讯测试
- '
- ' author: 木炭(WoodCoal)
- ' homepage: http://www.woodcoal.cn/
- ' memo: 简单网络通讯测试工具
- ' release: 2009-03-18
- '
- '--------------------------------------------------
- Private Sub cmdClose_Click()
- sckTest.Close
- End Sub
- Private Sub cmdSend_Click()
- If sckTest.State <> sckClosed Then
- sckTest.Close
- End If
- sckTest.Connect txtIP.Text, txtPort.Text
- End Sub
- Private Sub Form_Load()
- txtCommand.Text = "GET / HTTP/1.1" & vbCrLf & _
- "Accept: */*" & vbCrLf & _
- "Accept-Encoding: gzip , deflate" & vbCrLf & _
- "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)" & vbCrLf & _
- "Host: 127.0.0.1" & vbCrLf & _
- "Connection: Keep-Alive" & vbCrLf & vbCrLf
- End Sub
- Private Sub sckTest_Close()
- sckTest.Close
- End Sub
- Private Sub sckTest_Connect()
- txtInfo.Text = ""
- sckTest.SendData txtCommand.Text
- End Sub
- Private Sub sckTest_DataArrival(ByVal bytesTotal As Long)
- Dim strData As String
- sckTest.GetData strData, vbString
- txtInfo.Text = txtInfo.Text & strData
- End Sub
- Private Sub sckTest_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
- MsgBox Description
- End Sub
- Private Sub sckTest_SendComplete()
- 'sckTest.Close
- End Sub
· 本文由 木炭 发布在《激情燃烧的木炭》 上,原文地址为:http://www.woodcoal.cn/product/tools/2009318-1680-573.html(转载请保留本信息、全文内容和链接)
· 点击下载《通讯测试》中涉及到的附件
快捷导航
- 上一篇:没有了
- 下一篇:没有了
发表评论