home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / Code / ch40 / PlatWSCont / PlatWECont41Srv.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-02  |  10.0 KB  |  280 lines

  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
  4. Begin VB.Form PlatWSCont41Srv 
  5.    BackColor       =   &H00FFFFFF&
  6.    Caption         =   "Platinum Ch 41 Server"
  7.    ClientHeight    =   5595
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   5880
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5595
  13.    ScaleWidth      =   5880
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.CommandButton cmdReadLocalPort 
  16.       Caption         =   "Read Local Port"
  17.       Height          =   375
  18.       Left            =   3960
  19.       TabIndex        =   13
  20.       Top             =   5160
  21.       Width           =   1695
  22.    End
  23.    Begin VB.CommandButton cmdReadServerState 
  24.       Caption         =   "Read Server State"
  25.       Height          =   375
  26.       Left            =   3960
  27.       TabIndex        =   12
  28.       Top             =   4740
  29.       Width           =   1695
  30.    End
  31.    Begin VB.CommandButton cmdReadRemotePort 
  32.       Caption         =   "Read RemotePort"
  33.       Height          =   375
  34.       Left            =   3960
  35.       TabIndex        =   11
  36.       Top             =   4320
  37.       Width           =   1695
  38.    End
  39.    Begin VB.TextBox txtrequestID 
  40.       Height          =   375
  41.       Left            =   1920
  42.       TabIndex        =   10
  43.       Text            =   "requestID or Local Port"
  44.       Top             =   5160
  45.       Width           =   1995
  46.    End
  47.    Begin VB.TextBox txtServerState 
  48.       Height          =   375
  49.       Left            =   1920
  50.       TabIndex        =   8
  51.       Text            =   "Server State"
  52.       Top             =   4740
  53.       Width           =   1995
  54.    End
  55.    Begin VB.TextBox txtRemotePort 
  56.       Height          =   375
  57.       Left            =   1920
  58.       TabIndex        =   6
  59.       Text            =   "RemotePort"
  60.       Top             =   4320
  61.       Width           =   1995
  62.    End
  63.    Begin MSWinsockLib.Winsock wskServer 
  64.       Left            =   4980
  65.       Top             =   240
  66.       _ExtentX        =   741
  67.       _ExtentY        =   741
  68.    End
  69.    Begin RichTextLib.RichTextBox rtbServInBound 
  70.       Height          =   1215
  71.       Left            =   180
  72.       TabIndex        =   2
  73.       Top             =   3000
  74.       Width           =   5475
  75.       _ExtentX        =   9657
  76.       _ExtentY        =   2143
  77.       _Version        =   327680
  78.       TextRTF         =   $"PlatWECont41Srv.frx":0000
  79.    End
  80.    Begin RichTextLib.RichTextBox rtbServOutBound 
  81.       Height          =   1215
  82.       Left            =   180
  83.       TabIndex        =   1
  84.       Top             =   1260
  85.       Width           =   5475
  86.       _ExtentX        =   9657
  87.       _ExtentY        =   2143
  88.       _Version        =   327680
  89.       MousePointer    =   3
  90.       TextRTF         =   $"PlatWECont41Srv.frx":00D7
  91.    End
  92.    Begin VB.Label lblrequestID 
  93.       Alignment       =   2  'Center
  94.       BackColor       =   &H00FF0000&
  95.       BorderStyle     =   1  'Fixed Single
  96.       Caption         =   "requestID"
  97.       BeginProperty Font 
  98.          Name            =   "MS Sans Serif"
  99.          Size            =   12
  100.          Charset         =   0
  101.          Weight          =   700
  102.          Underline       =   0   'False
  103.          Italic          =   0   'False
  104.          Strikethrough   =   0   'False
  105.       EndProperty
  106.       ForeColor       =   &H00FFFFFF&
  107.       Height          =   375
  108.       Index           =   1
  109.       Left            =   180
  110.       TabIndex        =   9
  111.       Top             =   5160
  112.       Width           =   1695
  113.    End
  114.    Begin VB.Label lblSErverState 
  115.       Alignment       =   2  'Center
  116.       BackColor       =   &H00FF0000&
  117.       BorderStyle     =   1  'Fixed Single
  118.       Caption         =   "Server State"
  119.       BeginProperty Font 
  120.          Name            =   "MS Sans Serif"
  121.          Size            =   12
  122.          Charset         =   0
  123.          Weight          =   700
  124.          Underline       =   0   'False
  125.          Italic          =   0   'False
  126.          Strikethrough   =   0   'False
  127.       EndProperty
  128.       ForeColor       =   &H00FFFFFF&
  129.       Height          =   375
  130.       Index           =   1
  131.       Left            =   180
  132.       TabIndex        =   7
  133.       Top             =   4740
  134.       Width           =   1695
  135.    End
  136.    Begin VB.Label lblRemotelPort 
  137.       Alignment       =   2  'Center
  138.       BackColor       =   &H00FF0000&
  139.       BorderStyle     =   1  'Fixed Single
  140.       Caption         =   "RemotePort"
  141.       BeginProperty Font 
  142.          Name            =   "MS Sans Serif"
  143.          Size            =   12
  144.          Charset         =   0
  145.          Weight          =   700
  146.          Underline       =   0   'False
  147.          Italic          =   0   'False
  148.          Strikethrough   =   0   'False
  149.       EndProperty
  150.       ForeColor       =   &H00FFFFFF&
  151.       Height          =   375
  152.       Left            =   180
  153.       TabIndex        =   5
  154.       Top             =   4320
  155.       Width           =   1695
  156.    End
  157.    Begin VB.Label lblServInBnd 
  158.       Alignment       =   2  'Center
  159.       BackColor       =   &H000000FF&
  160.       BorderStyle     =   1  'Fixed Single
  161.       Caption         =   "Inbound"
  162.       BeginProperty Font 
  163.          Name            =   "MS Sans Serif"
  164.          Size            =   12
  165.          Charset         =   0
  166.          Weight          =   700
  167.          Underline       =   0   'False
  168.          Italic          =   0   'False
  169.          Strikethrough   =   0   'False
  170.       EndProperty
  171.       ForeColor       =   &H00FFFFFF&
  172.       Height          =   375
  173.       Left            =   180
  174.       TabIndex        =   4
  175.       Top             =   2580
  176.       Width           =   5475
  177.    End
  178.    Begin VB.Label lblServOutBnd 
  179.       Alignment       =   2  'Center
  180.       BackColor       =   &H000000FF&
  181.       BorderStyle     =   1  'Fixed Single
  182.       Caption         =   "Outbound"
  183.       BeginProperty Font 
  184.          Name            =   "MS Sans Serif"
  185.          Size            =   12
  186.          Charset         =   0
  187.          Weight          =   700
  188.          Underline       =   0   'False
  189.          Italic          =   0   'False
  190.          Strikethrough   =   0   'False
  191.       EndProperty
  192.       ForeColor       =   &H00FFFFFF&
  193.       Height          =   375
  194.       Left            =   180
  195.       TabIndex        =   3
  196.       Top             =   840
  197.       Width           =   5475
  198.    End
  199.    Begin VB.Label lblServer 
  200.       Alignment       =   2  'Center
  201.       BackColor       =   &H00FF0000&
  202.       BorderStyle     =   1  'Fixed Single
  203.       Caption         =   "The Server"
  204.       BeginProperty Font 
  205.          Name            =   "MS Sans Serif"
  206.          Size            =   24
  207.          Charset         =   0
  208.          Weight          =   700
  209.          Underline       =   0   'False
  210.          Italic          =   0   'False
  211.          Strikethrough   =   0   'False
  212.       EndProperty
  213.       ForeColor       =   &H00FFFFFF&
  214.       Height          =   615
  215.       Left            =   1140
  216.       TabIndex        =   0
  217.       Top             =   180
  218.       Width           =   3615
  219.    End
  220. Attribute VB_Name = "PlatWSCont41Srv"
  221. Attribute VB_GlobalNameSpace = False
  222. Attribute VB_Creatable = False
  223. Attribute VB_PredeclaredId = True
  224. Attribute VB_Exposed = False
  225. Option Explicit
  226. Private Sub cmdReadLocalPort_Click()
  227.     'This reads and displays the LocalPort property.
  228.     txtrequestID.Text = wskServer.LocalPort
  229. End Sub
  230. Private Sub cmdReadRemotePort_Click()
  231.     'Read the RemotePort property and display in the txtRemotePort.
  232.     txtRemotePort.Text = wskServer.RemotePort
  233. End Sub
  234. Private Sub cmdReadServerState_Click()
  235.     'Read and Display the current Server State
  236.     txtServerState.Text = wskServer.State
  237. End Sub
  238. Private Sub Form_Load()
  239.     'The name of the Winsock control for the server is wskServer
  240.     '   This name is the object when setting a property such as
  241.     '   object.property or wskServer.Property
  242.     'The LocalPort property can be set at design time or in code at runtime.
  243.     '   The LocalPort property has a data type of Long Integer.
  244.     '   This is port number on which the Server will be listening and must match
  245.     '   the RemotePort property of the Client.
  246.     wskServer.LocalPort = 1001
  247.     'The Listen method is used to start the server monitoring incoming requests
  248.     '   for a connection.
  249.     wskServer.Listen
  250. End Sub
  251. Private Sub rtbServOutBound_Change()
  252.     'The RichTextBox_Change event is being used to send data.  The contents of the
  253.     '   RichTextBox rtbServOutBound will be transmitted each time the contents of the
  254.     '   Text property is changed.  The SendData method is used with the argument of
  255.     '   RichTextBox.Text
  256.     wskServer.SendData rtbServOutBound.Text
  257. End Sub
  258. Private Sub wskServer_ConnectionRequest(ByVal requestID As Long)
  259.     'Check to determine whether the WinSock Control's state is closed.
  260.     '   If it is not, then close the control before using the Accept method.
  261.     If wskServer.State <> sckClosed Then wskServer.Close
  262.     'The control is now prepared to use the Accept method which will receive the
  263.     '   ConnectionRequest from the Client.
  264.     '   The argument for the Accept method is requestID
  265.     wskServer.Accept requestID
  266.     'The requestID is displayed
  267.     txtrequestID.Text = requestID
  268. End Sub
  269. Private Sub wskServer_DataArrival(ByVal bytesTotal As Long)
  270.     'The variable strData is declared to hold the incoming data.  It is stored as
  271.     '   a variant.
  272.     Dim strData As String
  273.     'The GetData method takes the data from the incoming buffer and places it in
  274.     '   the strData variable.
  275.     wskServer.GetData strData
  276.     'The strData variable contents are placed in the RichTextBox rtbClntInBound.Text
  277.     '   property
  278.     rtbServInBound.Text = strData
  279. End Sub
  280.