📄 form1.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4065
ClientLeft = 60
ClientTop = 450
ClientWidth = 9810
LinkTopic = "Form1"
ScaleHeight = 4065
ScaleWidth = 9810
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command3
Caption = "给目的服务器发数据"
Height = 735
Left = 6120
TabIndex = 4
Top = 2160
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "连接目的服务器"
Height = 735
Left = 3720
TabIndex = 3
Top = 2160
Width = 1935
End
Begin MSWinsockLib.Winsock Winsock1
Left = 360
Top = 1920
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "读文件"
Height = 495
Left = 1800
TabIndex = 2
Top = 2040
Width = 1335
End
Begin VB.TextBox Text1
Height = 1335
Left = 1920
TabIndex = 1
Text = "Text1"
Top = 360
Width = 7215
End
Begin VB.Label Label1
Caption = "c:\myfile.doc"
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(100) As Byte
Private Sub Command1_Click()
Dim temp As Byte
Dim myString As String
Open "c:\myfile.txt" For Binary As #1
Dim i As Integer
For i = 1 To LOF(1)
Get #1, i, temp
a(i - 1) = temp
myString = myString & Chr(a(i - 1))
j = 0
Dim flag
flag = 1
While flag = 1
If Chr(j) = Chr(a(i - 1)) Then
MsgBox j & Chr(j)
flag = 2
End If
j = j + 1
Wend
Next
MsgBox myString
Winsock1.SendData myString
End Sub
Private Sub Command2_Click()
Winsock1.SendData "CONNECT 192.168.0.33:7777 HTTP/1.0 " & Chr(13) & Chr(10) & "HOST 192.168.0.33:7777" & Chr(13) & Chr(10) & Chr(13) & Chr(10) ' & "Authorization: Basic Z21jYzpnbWNj=" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Proxy-Authorization: Basic Z21jYzpnbWNj=" & Chr(13) & Chr(10) & Chr(13) & Chr(10)
End Sub
Private Sub Command3_Click()
Dim a As String
a = "nihao"
Winsock1.SendData a
End Sub
Private Sub Form_Load()
Text1.Text = ""
Winsock1.RemoteHost = "192.168.0.157"
Winsock1.RemotePort = 8080
Winsock1.Connect
DoEvents
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim a As String
Dim b() As Byte
MsgBox ("get date")
Winsock1.GetData b
For i = 0 To UBound(b)
a = a & Chr(b(i))
Next
MsgBox a
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -