myserver.frm
来自「Winsock的服务端和客户端 Winsock的服务端和客户端」· FRM 代码 · 共 53 行
FRM
53 行
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form myserver
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin MSWinsockLib.Winsock myserver
Left = 840
Top = 1560
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
End
Attribute VB_Name = "myserver"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
myserver.LocalPort = 5211
myserver.bind
myserver.Listen
End Sub
Private Sub myServer_ConnectionRequest(ByVal requestID As Long)
If myserver.State <> sckClosed Then
myserver.Close
End If
myserver.Accept requestID
End Sub
Private Sub myServer_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
myserver.GetData strData
If strData = "hello" Then
MsgBox ("收到数据!")
End If
End Sub
Private Sub myServer_Close()
myserver.Close
myserver.Listen
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?