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

📄 server.frm

📁 用VB模拟实现网络中乌托邦协议,有需要的朋友可以下载
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Server 
   Caption         =   "Server"
   ClientHeight    =   3420
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4890
   LinkTopic       =   "Form1"
   ScaleHeight     =   3420
   ScaleWidth      =   4890
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "&Exit"
      Height          =   375
      Left            =   2400
      TabIndex        =   3
      Top             =   2640
      Width           =   1695
   End
   Begin MSWinsockLib.Winsock Winsock1 
      Left            =   0
      Top             =   2760
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.CommandButton Command1 
      Caption         =   "&Send"
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   2640
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Text            =   "Hi!"
      Top             =   2040
      Width           =   4335
   End
   Begin VB.TextBox Text1 
      Height          =   1695
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   0
      Text            =   "Server.frx":0000
      Top             =   120
      Width           =   4335
   End
End
Attribute VB_Name = "Server"
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 (Text2.Text = "") Then Text2.Text = "请不要传输空值"

Text1.Text = Text1.Text + CR + Text2.Text
Winsock1.SendData (Text2.Text)
Text2.Text = ""
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept (requestID)
Text1.Text = Text1.Text & "Connect succsses"

End Sub


Private Sub Form_Load()
CR = Chr$(13) + Chr$(10)
Winsock1.Close
Winsock1.LocalPort = 8000
Winsock1.Listen
End Sub

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

End Sub

⌨️ 快捷键说明

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