home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / jpi / warbot.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-01-09  |  3.2 KB  |  115 lines

  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   1455
  7.    ClientLeft      =   3540
  8.    ClientTop       =   1515
  9.    ClientWidth     =   3615
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   1455
  14.    ScaleWidth      =   3615
  15.    ShowInTaskbar   =   0   'False
  16.    Begin VB.CommandButton Command2 
  17.       Caption         =   "Disconnect"
  18.       Height          =   375
  19.       Left            =   2400
  20.       TabIndex        =   5
  21.       Top             =   960
  22.       Width           =   1095
  23.    End
  24.    Begin MSWinsockLib.Winsock Winsock1 
  25.       Left            =   1440
  26.       Top             =   840
  27.       _ExtentX        =   741
  28.       _ExtentY        =   741
  29.    End
  30.    Begin VB.CommandButton Command1 
  31.       Caption         =   "Go"
  32.       Height          =   375
  33.       Left            =   120
  34.       TabIndex        =   4
  35.       Top             =   960
  36.       Width           =   1095
  37.    End
  38.    Begin VB.TextBox Text2 
  39.       Height          =   285
  40.       Left            =   600
  41.       TabIndex        =   2
  42.       Text            =   "4000"
  43.       Top             =   480
  44.       Width           =   2895
  45.    End
  46.    Begin VB.TextBox Text1 
  47.       Height          =   285
  48.       Left            =   600
  49.       TabIndex        =   0
  50.       Top             =   120
  51.       Width           =   2895
  52.    End
  53.    Begin VB.Label Label2 
  54.       Caption         =   "Port"
  55.       Height          =   255
  56.       Left            =   120
  57.       TabIndex        =   3
  58.       Top             =   480
  59.       Width           =   615
  60.    End
  61.    Begin VB.Label Label1 
  62.       Caption         =   "IP"
  63.       Height          =   255
  64.       Left            =   120
  65.       TabIndex        =   1
  66.       Top             =   120
  67.       Width           =   615
  68.    End
  69. Attribute VB_Name = "Form1"
  70. Attribute VB_GlobalNameSpace = False
  71. Attribute VB_Creatable = False
  72. Attribute VB_PredeclaredId = True
  73. Attribute VB_Exposed = False
  74. Private GotData As String
  75. Private ConnectedToServer As Boolean
  76. Private Sub Command1_Click()
  77. Winsock1.RemoteHost = Text1.Text
  78. Winsock1.RemotePort = Val(Text2.Text)
  79. Winsock1.Connect
  80.   DoEvents
  81.   If ConnectedToServer = True Then Exit Do
  82. Call waitforincomingdata
  83. Call SendData(1001, "WarBot")
  84. Call waitforincomingdata
  85.   Starttime = Timer + 4
  86.     If Timer > Starttime Then Exit Do
  87.     DoEvents
  88.   Loop
  89.   Call SendData(1009, "00010001000500050005000000050000|")
  90. End Sub
  91. Sub SendData(DataCode, DataString)
  92. If ConnectedToServer = True Then
  93.   Winsock1.SendData DataCode & DataString
  94. End If
  95. End Sub
  96. Sub waitforincomingdata()
  97. DoEvents
  98. If GotData <> "" Then Exit Do
  99. End Sub
  100. Private Sub Command2_Click()
  101. Call SendData(1007, "Yo")
  102. DoEvents
  103. End Sub
  104. Private Sub Form_Unload(Cancel As Integer)
  105. End Sub
  106. Private Sub Winsock1_Connect()
  107. ConnectedToServer = True
  108. End Sub
  109. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  110. Dim SData As String
  111. On Error Resume Next
  112. Winsock1.GetData SData, vbString
  113. GotData = SData
  114. End Sub
  115.