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

📄 client.frm

📁 用VB模拟实现网络中乌托邦协议,有需要的朋友可以下载
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Client 
   Caption         =   "Client"
   ClientHeight    =   3480
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4845
   LinkTopic       =   "Form1"
   ScaleHeight     =   3480
   ScaleWidth      =   4845
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1800
      TabIndex        =   5
      Top             =   3120
      Width           =   2655
   End
   Begin VB.CommandButton Command3 
      Caption         =   "&Exit"
      Height          =   375
      Left            =   3240
      TabIndex        =   4
      Top             =   2640
      Width           =   1215
   End
   Begin MSWinsockLib.Winsock Winsock1 
      Left            =   1800
      Top             =   960
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "&Connect"
      Height          =   375
      Left            =   1560
      TabIndex        =   3
      Top             =   2640
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "&Send"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   2640
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Height          =   1695
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   1
      Text            =   "Client.frx":0000
      Top             =   120
      Width           =   4335
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Text            =   "Hi!"
      Top             =   2040
      Width           =   4335
   End
   Begin VB.Label Label1 
      Caption         =   "输入服务器IP"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   3120
      Width           =   1095
   End
End
Attribute VB_Name = "Client"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CR As String

Private Sub Command1_Click()
If (Text1.Text = "") Then Text1.Text = "请不要传输空值"
Text2.Text = Text2.Text + CR + Text1.Text
Winsock1.SendData (Text1.Text)
Text1.Text = ""
End Sub


Private Sub Command2_Click()
Winsock1.Close
Winsock1.RemoteHost = Text3.Text
Winsock1.RemotePort = 8000
Winsock1.Connect
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
CR = Chr$(13) + Chr$(10)
Winsock1.Close
Winsock1.RemoteHost = Text3.Text
Winsock1.RemotePort = 8000
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim str As String
Winsock1.GetData str, vbString
Text2.Text = Text2.Text + CR + str


End Sub

⌨️ 快捷键说明

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