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

📄 frmclient.frm

📁 局域网聊天的开始,winscok,适宜初学都学习通信类开发
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmClient 
   Caption         =   "TCP Client"
   ClientHeight    =   5160
   ClientLeft      =   7710
   ClientTop       =   4605
   ClientWidth     =   6510
   LinkTopic       =   "Form1"
   ScaleHeight     =   5160
   ScaleWidth      =   6510
   Begin VB.CommandButton cmdConnection 
      Caption         =   "Connect"
      Height          =   495
      Left            =   2640
      TabIndex        =   2
      Top             =   3000
      Width           =   1215
   End
   Begin VB.TextBox txtOutput 
      Height          =   495
      Left            =   2640
      TabIndex        =   1
      Top             =   1800
      Width           =   1215
   End
   Begin VB.TextBox txtSend 
      Height          =   495
      Left            =   2640
      TabIndex        =   0
      Top             =   1080
      Width           =   1215
   End
   Begin MSWinsockLib.Winsock tcpClient 
      Left            =   5640
      Top             =   4320
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.Label Label2 
      Caption         =   "接收到的"
      Height          =   495
      Left            =   1200
      TabIndex        =   4
      Top             =   1800
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "输入你的发送"
      Height          =   495
      Left            =   1080
      TabIndex        =   3
      Top             =   1080
      Width           =   1215
   End
End
Attribute VB_Name = "frmClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdConnection_Click()

    ' Invoke the Connect method to initiate a
    ' connection.
    tcpClient.Connect
End Sub

Private Sub Form_Load()

    ' The name of the Winsock control is tcpClient.
    ' Note: to specify a remote host, you can use
    ' either the IP address (ex: \"121.111.1.1\") or
    ' the computer’s \"friendly\" name, as shown here.
    tcpClient.RemoteHost = "YX396"
    tcpClient.RemotePort = 1001

End Sub

Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)

    Dim strData As String
    tcpClient.GetData strData
    txtOutput.Text = strData

End Sub

Private Sub txtSend_Change()

    tcpClient.SendData txtSend.Text

End Sub

⌨️ 快捷键说明

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