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

📄 frmclient2.frm

📁 这是VB6.0上MSDN的例子
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmclient2 
   AutoRedraw      =   -1  'True
   Caption         =   "Form1"
   ClientHeight    =   5010
   ClientLeft      =   60
   ClientTop       =   375
   ClientWidth     =   4965
   LinkTopic       =   "Form1"
   ScaleHeight     =   5010
   ScaleWidth      =   4965
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdconnect 
      Caption         =   "连接"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   4200
      Width           =   975
   End
   Begin VB.TextBox txtoutput 
      Height          =   1335
      Left            =   600
      MultiLine       =   -1  'True
      TabIndex        =   1
      Top             =   2640
      Width           =   3615
   End
   Begin VB.TextBox txtsend 
      Height          =   1215
      Left            =   600
      MultiLine       =   -1  'True
      TabIndex        =   0
      Top             =   720
      Width           =   3615
   End
   Begin MSWinsockLib.Winsock wskclient2 
      Left            =   0
      Top             =   0
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.Label labsend 
      Caption         =   "发送数据"
      Height          =   255
      Left            =   600
      TabIndex        =   4
      Top             =   480
      Width           =   1575
   End
   Begin VB.Label laboutput 
      Caption         =   "输出数据"
      Height          =   255
      Left            =   600
      TabIndex        =   3
      Top             =   2400
      Width           =   1455
   End
End
Attribute VB_Name = "frmclient2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()

   'Winsock 控件的名字为 wskclient。
   '注意:要指定远程主机,可以使用IP 地址(例如:"121.111.1.1"),也可以使用计算机的“好听的名字”如下所示。
   
   wskclient2.RemoteHost = "172.0.0.2"
   wskclient2.RemotePort = 10000
   
End Sub

Private Sub cmdconnect_Click()

    '调用 Connect 方法,初始化连接。
    wskclient2.Connect

End Sub


Private Sub txtsend_Change()
    
    wskclient2.SendData txtsend.Text
    
End Sub

Private Sub wskclient2_DataArrival(ByVal bytesTotal As Long)

   Dim strData As String
   wskclient2.GetData strData
   frmclient2.txtoutput.Text = strData
   
End Sub



⌨️ 快捷键说明

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