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

📄 server.frm

📁 运用vb的winsock等控件实现简单的通信!(类似局域网聊天)
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form server 
   Caption         =   "Form1"
   ClientHeight    =   5865
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8040
   LinkTopic       =   "Form1"
   Picture         =   "server.frx":0000
   ScaleHeight     =   5865
   ScaleWidth      =   8040
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "发    送"
      Height          =   495
      Left            =   4680
      TabIndex        =   5
      Top             =   4440
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "退   出"
      Height          =   495
      Left            =   1920
      TabIndex        =   2
      Top             =   4440
      Width           =   1215
   End
   Begin VB.TextBox textget 
      Height          =   1815
      Left            =   1560
      TabIndex        =   1
      Top             =   240
      Width           =   4815
   End
   Begin VB.TextBox textsend 
      Height          =   1935
      Left            =   1560
      TabIndex        =   0
      Top             =   2040
      Width           =   4815
   End
   Begin MSWinsockLib.Winsock Winsockserver 
      Left            =   360
      Top             =   3600
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
      LocalPort       =   1001
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "接   收"
      ForeColor       =   &H00FFFF00&
      Height          =   495
      Left            =   240
      TabIndex        =   4
      Top             =   600
      Width           =   1215
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "发   送"
      ForeColor       =   &H00FFFF00&
      Height          =   495
      Left            =   240
      TabIndex        =   3
      Top             =   2280
      Width           =   1215
   End
End
Attribute VB_Name = "server"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
     End
    End Sub
   
Private Sub Command2_Click()
Winsockserver.SendData Textsend.Text
End Sub

    Private Sub Form_Load()
     Textsend.Visible = False
     Textget.Visible = False
     Winsockserver.LocalPort = 1001
     Winsockserver.Listen
    End Sub
   
    Private Sub textsend_Change()
     'Winsockserver.SendData textsend.Text
    End Sub
   
    Private Sub Winsockserver_Close()
     Winsockserver.Close
     End
    End Sub
   
    Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long)
     Textsend.Visible = True
     Textget.Visible = True
     If Winsockserver.State <> sckClosed Then Winsockserver.Close
     Winsockserver.Accept requestID
    End Sub
   
    Private Sub Winsockserver_DataArrival(ByVal bytesTotal As Long)
     Dim tmpstr As String
     Winsockserver.GetData tmpstr
     Textget.Text = tmpstr
    End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -