home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / socketx / CTLFAST5.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-23  |  9.5 KB  |  282 lines

  1. VERSION 5.00
  2. Object = "{C7212F93-30E8-11D2-B450-0020AFD69DE6}#1.0#0"; "SocketX.OCX"
  3. Begin VB.Form Form1 
  4.    Appearance      =   0  'Flat
  5.    BackColor       =   &H00C0C0C0&
  6.    Caption         =   "Socket/X w/ Fast Notifications"
  7.    ClientHeight    =   2400
  8.    ClientLeft      =   1935
  9.    ClientTop       =   2745
  10.    ClientWidth     =   5130
  11.    BeginProperty Font 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    LinkTopic       =   "Form1"
  22.    PaletteMode     =   1  'UseZOrder
  23.    ScaleHeight     =   2400
  24.    ScaleWidth      =   5130
  25.    Begin SocketXCtl.SocketXCtl SocketXCtl1 
  26.       Left            =   120
  27.       Top             =   0
  28.       AcceptTimeout   =   0
  29.       BlockingMode    =   0
  30.       Blocking        =   -1  'True
  31.       BroadcastEnabled=   -1  'True
  32.       ConnectTimeout  =   0
  33.       EventMask       =   63
  34.       KeepAliveEnabled=   0   'False
  35.       LibraryName     =   "WSOCK32.DLL"
  36.       LingerEnabled   =   0   'False
  37.       LingerMode      =   0
  38.       LingerTime      =   0
  39.       LocalAddress    =   ""
  40.       LocalPort       =   0
  41.       OutOfBandEnabled=   0   'False
  42.       ReceiveBufferSize=   8192
  43.       ReceiveTimeout  =   0
  44.       RemoteAddress   =   ""
  45.       RemoteName      =   ""
  46.       ReuseAddressEnabled=   0   'False
  47.       RemotePort      =   0
  48.       RouteEnabled    =   -1  'True
  49.       SendTimeout     =   0
  50.       SendBufferSize  =   8192
  51.       SocketType      =   0
  52.       TcpNoDelayEnabled=   0   'False
  53.    End
  54.    Begin VB.TextBox Text3 
  55.       Appearance      =   0  'Flat
  56.       BeginProperty Font 
  57.          Name            =   "MS Sans Serif"
  58.          Size            =   8.25
  59.          Charset         =   0
  60.          Weight          =   400
  61.          Underline       =   0   'False
  62.          Italic          =   0   'False
  63.          Strikethrough   =   0   'False
  64.       EndProperty
  65.       Height          =   285
  66.       Left            =   1800
  67.       TabIndex        =   2
  68.       Text            =   "5"
  69.       Top             =   1320
  70.       Width           =   855
  71.    End
  72.    Begin VB.TextBox Text2 
  73.       Appearance      =   0  'Flat
  74.       BeginProperty Font 
  75.          Name            =   "MS Sans Serif"
  76.          Size            =   8.25
  77.          Charset         =   0
  78.          Weight          =   400
  79.          Underline       =   0   'False
  80.          Italic          =   0   'False
  81.          Strikethrough   =   0   'False
  82.       EndProperty
  83.       Height          =   285
  84.       Left            =   1800
  85.       TabIndex        =   4
  86.       Text            =   "80"
  87.       Top             =   960
  88.       Width           =   855
  89.    End
  90.    Begin VB.TextBox Text1 
  91.       Appearance      =   0  'Flat
  92.       BeginProperty Font 
  93.          Name            =   "MS Sans Serif"
  94.          Size            =   8.25
  95.          Charset         =   0
  96.          Weight          =   400
  97.          Underline       =   0   'False
  98.          Italic          =   0   'False
  99.          Strikethrough   =   0   'False
  100.       EndProperty
  101.       Height          =   285
  102.       Left            =   1800
  103.       TabIndex        =   3
  104.       Text            =   "198.211.8.88"
  105.       Top             =   600
  106.       Width           =   3015
  107.    End
  108.    Begin VB.CommandButton Command1 
  109.       Appearance      =   0  'Flat
  110.       BackColor       =   &H80000005&
  111.       Caption         =   "Test Connection"
  112.       BeginProperty Font 
  113.          Name            =   "MS Sans Serif"
  114.          Size            =   8.25
  115.          Charset         =   0
  116.          Weight          =   400
  117.          Underline       =   0   'False
  118.          Italic          =   0   'False
  119.          Strikethrough   =   0   'False
  120.       EndProperty
  121.       Height          =   375
  122.       Left            =   1800
  123.       TabIndex        =   0
  124.       Top             =   1920
  125.       Width           =   1695
  126.    End
  127.    Begin VB.Label Label5 
  128.       Alignment       =   1  'Right Justify
  129.       Appearance      =   0  'Flat
  130.       BackColor       =   &H00C0C0C0&
  131.       Caption         =   "(in secs)"
  132.       BeginProperty Font 
  133.          Name            =   "MS Sans Serif"
  134.          Size            =   8.25
  135.          Charset         =   0
  136.          Weight          =   400
  137.          Underline       =   0   'False
  138.          Italic          =   0   'False
  139.          Strikethrough   =   0   'False
  140.       EndProperty
  141.       ForeColor       =   &H80000008&
  142.       Height          =   255
  143.       Left            =   840
  144.       TabIndex        =   8
  145.       Top             =   1560
  146.       Width           =   855
  147.    End
  148.    Begin VB.Label Label4 
  149.       Alignment       =   1  'Right Justify
  150.       Appearance      =   0  'Flat
  151.       BackColor       =   &H00C0C0C0&
  152.       Caption         =   "Timeout:"
  153.       BeginProperty Font 
  154.          Name            =   "MS Sans Serif"
  155.          Size            =   8.25
  156.          Charset         =   0
  157.          Weight          =   400
  158.          Underline       =   0   'False
  159.          Italic          =   0   'False
  160.          Strikethrough   =   0   'False
  161.       EndProperty
  162.       ForeColor       =   &H80000008&
  163.       Height          =   255
  164.       Left            =   480
  165.       TabIndex        =   5
  166.       Top             =   1320
  167.       Width           =   1215
  168.    End
  169.    Begin VB.Label Label3 
  170.       Alignment       =   1  'Right Justify
  171.       Appearance      =   0  'Flat
  172.       BackColor       =   &H00C0C0C0&
  173.       Caption         =   "Remote Port:"
  174.       BeginProperty Font 
  175.          Name            =   "MS Sans Serif"
  176.          Size            =   8.25
  177.          Charset         =   0
  178.          Weight          =   400
  179.          Underline       =   0   'False
  180.          Italic          =   0   'False
  181.          Strikethrough   =   0   'False
  182.       EndProperty
  183.       ForeColor       =   &H80000008&
  184.       Height          =   255
  185.       Left            =   360
  186.       TabIndex        =   7
  187.       Top             =   960
  188.       Width           =   1335
  189.    End
  190.    Begin VB.Label Label2 
  191.       Alignment       =   1  'Right Justify
  192.       Appearance      =   0  'Flat
  193.       BackColor       =   &H00C0C0C0&
  194.       Caption         =   "Remote IP:"
  195.       BeginProperty Font 
  196.          Name            =   "MS Sans Serif"
  197.          Size            =   8.25
  198.          Charset         =   0
  199.          Weight          =   400
  200.          Underline       =   0   'False
  201.          Italic          =   0   'False
  202.          Strikethrough   =   0   'False
  203.       EndProperty
  204.       ForeColor       =   &H80000008&
  205.       Height          =   255
  206.       Left            =   600
  207.       TabIndex        =   6
  208.       Top             =   600
  209.       Width           =   1095
  210.    End
  211.    Begin VB.Label Label1 
  212.       Appearance      =   0  'Flat
  213.       BackColor       =   &H00C0C0C0&
  214.       Caption         =   "Result:"
  215.       BeginProperty Font 
  216.          Name            =   "MS Sans Serif"
  217.          Size            =   8.25
  218.          Charset         =   0
  219.          Weight          =   400
  220.          Underline       =   0   'False
  221.          Italic          =   0   'False
  222.          Strikethrough   =   0   'False
  223.       EndProperty
  224.       ForeColor       =   &H80000008&
  225.       Height          =   255
  226.       Left            =   1080
  227.       TabIndex        =   1
  228.       Top             =   120
  229.       Width           =   3975
  230.    End
  231. Attribute VB_Name = "Form1"
  232. Attribute VB_GlobalNameSpace = False
  233. Attribute VB_Creatable = False
  234. Attribute VB_PredeclaredId = True
  235. Attribute VB_Exposed = False
  236. Implements ISocketXCtlNotify
  237. Private Sub Command1_Click()
  238.     MousePointer = 11
  239.     Command1.Enabled = False
  240.     Label1.Caption = "Result: "
  241.     'create the socket
  242.     SocketXCtl1.LocalAddress = "0.0.0.0"
  243.     SocketXCtl1.LocalPort = 0
  244.     SocketXCtl1.Create
  245.     'configure the control with the socket
  246.     'of the remote server
  247.     SocketXCtl1.RemoteAddress = Text1.Text
  248.     SocketXCtl1.RemotePort = CInt(Text2.Text)
  249.     SocketXCtl1.Blocking = False
  250.     '
  251.     'attempt to connect
  252.     SocketXCtl1.ConnectTimeout = CInt(Text3.Text)
  253.     SocketXCtl1.Connect
  254. End Sub
  255. Private Sub Form_Load()
  256.     SocketXCtl1.NotificationObject = Me
  257. End Sub
  258. Private Sub ISocketXCtlNotify_Accept(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal SocketHandle As Long, ByVal ErrorCode As Integer)
  259. End Sub
  260. Private Sub ISocketXCtlNotify_Close(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal ErrorCode As Integer)
  261. End Sub
  262. Private Sub ISocketXCtlNotify_Connect(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal ErrorCode As Integer)
  263. End Sub
  264. Private Sub ISocketXCtlNotify_Done(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal LastMethod As SocketXCtl.MethodsEnum, ByVal ErrorCode As Integer)
  265.     If LastMethod = soxConnect Then
  266.         If ErrorCode = 0 Then
  267.             Label1.Caption = Label1.Caption & "Connection is up."
  268.         Else
  269.             Label1.Caption = Label1.Caption & "Connection is NOT up (" & CStr(ErrorCode) & ")."
  270.         End If
  271.         SocketXCtl1.Close
  272.         Command1.Enabled = True
  273.         MousePointer = 0
  274.     End If
  275. End Sub
  276. Private Sub ISocketXCtlNotify_OutOfBandData(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal ErrorCode As Integer)
  277. End Sub
  278. Private Sub ISocketXCtlNotify_Receive(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal ErrorCode As Integer)
  279. End Sub
  280. Private Sub ISocketXCtlNotify_Send(ByVal SocketXCtl As SocketXCtl.ISocketXCtl, ByVal ErrorCode As Integer)
  281. End Sub
  282.