AuthorMessage
47686F7374
Clone
Posts: 6

Just make a program that connects to a hub and add on winsock_dataarival
Code:

   Dim HubData As String
   sock.GetData HubData
   If hubdata = "<" & BotOwner.Text & "> " & "hello|" then sock.SendData "<" + UserName.Text + "> " + "hello" & BotOwner.text + "|"
   if hubdata="<" & BotOwner.Text & "> " & "close|" then end

 
then use your imagination its simple to add more commands ,events ,functions to develop something nice
dzadzuks
Ametuar
Posts: 135

This just wont work out...
reason is: becasue if the hub sends a packet that can contain more commands in it (ex. <Nick> Hello|$Search blablabla|) Maybe you wont feel difference if you test the bot in hub with low user count, but in hub with ~100 users u can see that the bot wont answer MANY times when you send the command string!
Better way to do it would be to split the incoming data in "|", anyway split function for some reasons is very slow in VB6, so better is to use Instr Left, Right and loop etc functions to get one command out of each packet
b_w_johan
Regular
Posts: 56

dza, is split making it slower cause of using loads of ram then ??
if so i should most definately rebuild the hublistpinger i was wondering already how it was possible that it was taking 20.000kb ram additionally to just the server running
and i was thinking that i made some errors in creating debug logs, that that was using all that ram, or some leaking in the arrays
dzadzuks
Ametuar
Posts: 135

you can make a test with split function and and in some other way...
for example:
You wnt to split a string in 2 parts, this string will be "test this", and you want to split it in array like "test" and "this".
You could make it with split, and that would be easyer, but slower.
So with this test we will prove it:
Make 2 buttons and add code to 1st button:
Code:
Dim StartTime As Long
Dim EndTime As Long
Dim result() As String
Dim i As Integer
Dim stringz As String
stringz = "test this"
StartTime = GetTickCount
For i = 0 To 10000
result = Split(stringz, " ")
Next i
EndTime = GetTickCount
MsgBox EndTime - StartTime

this will be the code with SPLIT function as you see...
on the 2nd button add code:
Code:
Dim StartTime As Long
Dim EndTime As Long
Dim result(1) As String
Dim i As Integer
Dim stringz As String
stringz = "test this"
StartTime = GetTickCount
For i = 0 To 10000
result(0) = Left$(stringz, 4)
result(1) = Right$(stringz, 4)
Next i
EndTime = GetTickCount
MsgBox EndTime - StartTime

P.S - you need to add a module and declare the GetTickCount() functionto get the milliseconds:
Code:
Public Declare Function GetTickCount Lib "kernel32" () As Long

Both buttons will do the same work.. will split the string in array like "test" and "this", but click on them and see the time difference! Try to change the loop to 100000 times then the see the difference... 
P.S - if u change it to 100000 then dont forget to change the Dim i as integer to Dim i as Long