📄 sockserver.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form sockserver
Caption = "Form1"
ClientHeight = 5820
ClientLeft = 165
ClientTop = 735
ClientWidth = 4950
LinkTopic = "Form1"
ScaleHeight = 5820
ScaleWidth = 4950
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame4
Caption = "接收信息"
Height = 1815
Left = 0
TabIndex = 8
Top = 720
Width = 4935
Begin VB.TextBox Text2
Height = 1455
Left = 120
MultiLine = -1 'True
TabIndex = 9
Top = 240
Width = 4695
End
End
Begin VB.Frame Frame3
Height = 735
Left = 120
TabIndex = 5
Top = 5040
Width = 4815
Begin VB.CommandButton Command2
Caption = "取消"
Height = 255
Left = 2640
TabIndex = 7
Top = 240
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "发送"
Height = 255
Left = 840
TabIndex = 6
Top = 240
Width = 1215
End
End
Begin VB.Frame Frame2
Caption = "发送信息"
Height = 2295
Left = 0
TabIndex = 3
Top = 2640
Width = 4935
Begin VB.TextBox Text1
Height = 1815
Left = 120
MultiLine = -1 'True
TabIndex = 4
Top = 240
Width = 4695
End
End
Begin VB.Frame Frame1
Height = 615
Left = 0
TabIndex = 0
Top = 0
Width = 4935
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Height = 255
Left = 3120
TabIndex = 11
Top = 240
Width = 1695
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "本地ip:"
Height = 180
Left = 2160
TabIndex = 10
Top = 240
Width = 720
End
Begin VB.Label Lport
BorderStyle = 1 'Fixed Single
Height = 255
Left = 840
TabIndex = 2
Top = 240
Width = 615
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "端口为:"
Height = 180
Left = 120
TabIndex = 1
Top = 240
Width = 720
End
End
Begin MSWinsockLib.Winsock Winsock
Left = 2400
Top = 120
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Menu file
Caption = "文件"
Begin VB.Menu exit
Caption = "退出"
Shortcut = ^Q
End
End
End
Attribute VB_Name = "sockserver"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Winsock.SendData Text1.Text
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Form_Load()
Winsock.LocalPort = 4949
Winsock.Listen
Lport.Caption = Winsock.LocalPort
Label3.Caption = Winsock.LocalIP
End Sub
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim js As String
Winsock.GetData js, vbString
Text2.Text = js
End Sub
Private Sub winsock_connectionrequest(ByVal requestid As Long)
If Winsock.State <> sckClosed Then
Winsock.Close
Winsock.Accept requestid
End If
End Sub
Private Sub Winsock_Close()
Winsock.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -