⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myserver.frm

📁 Winsock的服务端和客户端 Winsock的服务端和客户端
💻 FRM
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -