home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / Code / ch40 / PlatWSCont / PlatWSCont41Clnt.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-02  |  10.9 KB  |  306 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 PlatWSCont41Clnt 
  5.    BackColor       =   &H00FFFFFF&
  6.    Caption         =   "Platinum Ch 41 Client"
  7.    ClientHeight    =   5595
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   5880
  11.    ForeColor       =   &H00000000&
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5595
  14.    ScaleWidth      =   5880
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.CommandButton cmdReadLocalPort 
  17.       Caption         =   "Read LocalPort"
  18.       Height          =   375
  19.       Left            =   3960
  20.       TabIndex        =   14
  21.       Top             =   5160
  22.       Width           =   1695
  23.    End
  24.    Begin VB.CommandButton cmdSetRemotePort 
  25.       Caption         =   "Set RemotePort"
  26.       Height          =   375
  27.       Left            =   3960
  28.       TabIndex        =   13
  29.       Top             =   4740
  30.       Width           =   1695
  31.    End
  32.    Begin VB.CommandButton cmdSetRemoteHost 
  33.       Caption         =   "Set RemoteHost"
  34.       Height          =   375
  35.       Left            =   3960
  36.       TabIndex        =   12
  37.       Top             =   4320
  38.       Width           =   1695
  39.    End
  40.    Begin VB.TextBox txtLocalPort 
  41.       Height          =   375
  42.       Left            =   1920
  43.       TabIndex        =   11
  44.       Text            =   "LocalPort"
  45.       Top             =   5160
  46.       Width           =   1995
  47.    End
  48.    Begin VB.TextBox txtRemotePort 
  49.       Height          =   375
  50.       Left            =   1920
  51.       TabIndex        =   9
  52.       Text            =   "1001"
  53.       Top             =   4740
  54.       Width           =   1995
  55.    End
  56.    Begin VB.TextBox txtRemoteHost 
  57.       Height          =   375
  58.       Left            =   1920
  59.       TabIndex        =   7
  60.       Text            =   "RemoteHost"
  61.       Top             =   4320
  62.       Width           =   1995
  63.    End
  64.    Begin VB.CommandButton cmdConnect 
  65.       BackColor       =   &H00E0E0E0&
  66.       Caption         =   "Connect"
  67.       BeginProperty Font 
  68.          Name            =   "MS Sans Serif"
  69.          Size            =   8.25
  70.          Charset         =   0
  71.          Weight          =   700
  72.          Underline       =   0   'False
  73.          Italic          =   0   'False
  74.          Strikethrough   =   0   'False
  75.       EndProperty
  76.       Height          =   615
  77.       Left            =   180
  78.       TabIndex        =   5
  79.       Top             =   180
  80.       Width           =   915
  81.    End
  82.    Begin MSWinsockLib.Winsock wskClient 
  83.       Left            =   4980
  84.       Top             =   240
  85.       _ExtentX        =   741
  86.       _ExtentY        =   741
  87.    End
  88.    Begin RichTextLib.RichTextBox rtbClntOutBound 
  89.       Height          =   1215
  90.       Left            =   180
  91.       TabIndex        =   1
  92.       Top             =   1260
  93.       Width           =   5475
  94.       _ExtentX        =   9657
  95.       _ExtentY        =   2143
  96.       _Version        =   327680
  97.       Enabled         =   -1  'True
  98.       MousePointer    =   3
  99.       TextRTF         =   $"PlatWSCont41Clnt.frx":0000
  100.    End
  101.    Begin RichTextLib.RichTextBox rtbClntInBound 
  102.       Height          =   1215
  103.       Left            =   180
  104.       TabIndex        =   2
  105.       Top             =   3000
  106.       Width           =   5475
  107.       _ExtentX        =   9657
  108.       _ExtentY        =   2143
  109.       _Version        =   327680
  110.       Enabled         =   -1  'True
  111.       TextRTF         =   $"PlatWSCont41Clnt.frx":00D8
  112.    End
  113.    Begin VB.Label lblLocalPort 
  114.       Alignment       =   2  'Center
  115.       BackColor       =   &H00FF0000&
  116.       BorderStyle     =   1  'Fixed Single
  117.       Caption         =   "LocalPort"
  118.       BeginProperty Font 
  119.          Name            =   "MS Sans Serif"
  120.          Size            =   12
  121.          Charset         =   0
  122.          Weight          =   700
  123.          Underline       =   0   'False
  124.          Italic          =   0   'False
  125.          Strikethrough   =   0   'False
  126.       EndProperty
  127.       ForeColor       =   &H00FFFFFF&
  128.       Height          =   375
  129.       Index           =   1
  130.       Left            =   180
  131.       TabIndex        =   10
  132.       Top             =   5160
  133.       Width           =   1695
  134.    End
  135.    Begin VB.Label lblRemotePort 
  136.       Alignment       =   2  'Center
  137.       BackColor       =   &H00FF0000&
  138.       BorderStyle     =   1  'Fixed Single
  139.       Caption         =   "RemotePort"
  140.       BeginProperty Font 
  141.          Name            =   "MS Sans Serif"
  142.          Size            =   12
  143.          Charset         =   0
  144.          Weight          =   700
  145.          Underline       =   0   'False
  146.          Italic          =   0   'False
  147.          Strikethrough   =   0   'False
  148.       EndProperty
  149.       ForeColor       =   &H00FFFFFF&
  150.       Height          =   375
  151.       Index           =   1
  152.       Left            =   180
  153.       TabIndex        =   8
  154.       Top             =   4740
  155.       Width           =   1695
  156.    End
  157.    Begin VB.Label lblRemoteHost 
  158.       Alignment       =   2  'Center
  159.       BackColor       =   &H00FF0000&
  160.       BorderStyle     =   1  'Fixed Single
  161.       Caption         =   "RemoteHost"
  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        =   6
  175.       Top             =   4320
  176.       Width           =   1695
  177.    End
  178.    Begin VB.Label lblClntInBnd 
  179.       Alignment       =   2  'Center
  180.       BackColor       =   &H00FF0000&
  181.       BorderStyle     =   1  'Fixed Single
  182.       Caption         =   "Inbound"
  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.       Index           =   0
  195.       Left            =   180
  196.       TabIndex        =   4
  197.       Top             =   2580
  198.       Width           =   5475
  199.    End
  200.    Begin VB.Label lblClntOutBnd 
  201.       Alignment       =   2  'Center
  202.       BackColor       =   &H00FF0000&
  203.       BorderStyle     =   1  'Fixed Single
  204.       Caption         =   "Outbound"
  205.       BeginProperty Font 
  206.          Name            =   "MS Sans Serif"
  207.          Size            =   12
  208.          Charset         =   0
  209.          Weight          =   700
  210.          Underline       =   0   'False
  211.          Italic          =   0   'False
  212.          Strikethrough   =   0   'False
  213.       EndProperty
  214.       ForeColor       =   &H00FFFFFF&
  215.       Height          =   375
  216.       Left            =   180
  217.       TabIndex        =   3
  218.       Top             =   840
  219.       Width           =   5475
  220.    End
  221.    Begin VB.Label lblClient 
  222.       Alignment       =   2  'Center
  223.       BackColor       =   &H000000FF&
  224.       BorderStyle     =   1  'Fixed Single
  225.       Caption         =   "The Client"
  226.       BeginProperty Font 
  227.          Name            =   "MS Sans Serif"
  228.          Size            =   24
  229.          Charset         =   0
  230.          Weight          =   700
  231.          Underline       =   0   'False
  232.          Italic          =   0   'False
  233.          Strikethrough   =   0   'False
  234.       EndProperty
  235.       ForeColor       =   &H00FFFFFF&
  236.       Height          =   615
  237.       Left            =   1140
  238.       TabIndex        =   0
  239.       Top             =   180
  240.       Width           =   3615
  241.    End
  242. Attribute VB_Name = "PlatWSCont41Clnt"
  243. Attribute VB_GlobalNameSpace = False
  244. Attribute VB_Creatable = False
  245. Attribute VB_PredeclaredId = True
  246. Attribute VB_Exposed = False
  247. Option Explicit
  248. Private Sub cmdConnect_Click()
  249.     'The command button click event is used to create the connection.
  250.     '   The connection request string is sent to the RemoteHost on the RemotePort.
  251.     '   The Connect method takes two arguements, in the form of
  252.     '       object.Connect remoteHost, remotePort
  253.     '   If the two properties are blank and the arguments are not supplied an error
  254.     '   occurs.  The two properties were set in the Form_Load event which occurs
  255.     '   prior to the Command_Click event.
  256.     wskClient.Connect
  257. End Sub
  258. Private Sub cmdReadLocalPort_Click()
  259.     'This will read and display the value of the LocalPort property in
  260.     '   txtLocalPort.Text
  261.     txtLocalPort.Text = wskClient.LocalPort
  262. End Sub
  263. Private Sub cmdSetRemoteHost_Click()
  264.     'This will set the value of the RemoteHost property to the value in
  265.     '   txtRemoteHost.Text
  266.     wskClient.RemoteHost = txtRemoteHost.Text
  267. End Sub
  268. Private Sub cmdSetRemotePort_Click()
  269.     'This will set the value of the RemotePort property to the value in
  270.     '   txtRemotePort.Text
  271.     wskClient.RemotePort = txtRemotePort.Text
  272. End Sub
  273. Private Sub Form_Load()
  274.     'The name of the Winsock control for the client is wskClient
  275.     '   This name is the object when setting a property such as
  276.     '   object.property or wskClient.Property
  277.     'The name of the remote host can be set at design time in the
  278.     '   properties dialog or it can be set at runtime in code.
  279.     '   Either the IP address "XXX.XXX.XXX.XXX" or a host friendly
  280.     '   name may be used such as "http://www.microsoft.com"
  281.     '   The RemoteHost property has a data type of string.
  282.     wskClient.RemoteHost = "SomeJunk"
  283.     'The RemotePort property can be set at design time or in code at runtime.
  284.     '   The RemotePort property has a data type of Long Integer.
  285.     '   This is port number on which the Server will be listening.
  286.     wskClient.RemotePort = 1002
  287. End Sub
  288. Private Sub rtbClntOutBound_Change()
  289.     'The RichTextBox_Change event is being used to send data.  The contents of the
  290.     '   RichTextBox rtbClntOutBound will be transmitted each time the contents of the
  291.     '   Text property is changed.  The SendData method is used with the argument of
  292.     '   RichTextBox.Text
  293.     wskClient.SendData rtbClntOutBound.Text
  294. End Sub
  295. Private Sub wskClient_DataArrival(ByVal bytesTotal As Long)
  296.     'The variable strData is declared to hold the incoming data.  It is stored as
  297.     '   a variant.
  298.     Dim strData As String
  299.     'The GetData method takes the data from the incoming buffer and places it in
  300.     '   the strData variable.
  301.     wskClient.GetData strData
  302.     'The strData variable contents are placed in the RichTextBox rtbClntInBound.Text
  303.     '   property
  304.     rtbClntInBound.Text = strData
  305. End Sub
  306.