Latac
09-03-2003, 02:01 PM
I been trying to figure this out.. I was looking at another project that parsed text and this is what I came up with :(
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
Winsock1.GetData Data
startpos = InStr(Data, "2;-/-/-/-;") + 10
newstring$ = Mid(Data, startpos, [10])
Text2.Text = newstring$
Winsock1.Close
End Sub
' 2;-/-/-/-;Solaris/0/0/Good ; ' <--- I gotta parse this so its, ServerName: Solaris UsersOn: 0
help please
Thanatos
09-03-2003, 02:05 PM
I'm not that familiar with WinSock but which of the two 0's is the number of users.
in the mean time look as this:
Dim a() As String
test$ = "2;-/-/-/-;Solaris/0/0/Good ;"
a = Split(test$, ";")
a = Split(a(2), "/")
MsgBox "Server: " & a(0) & " UsersOn: " & a(1)
Latac
09-03-2003, 02:06 PM
Thank you that worked very well, didn't know you could do that! ^_^
Latac
09-03-2003, 02:32 PM
actually minor problem It is the second 0 that is the user count.. so:
I tried doing it myself.. :/
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
Dim a() As String
' ''
Winsock1.GetData Data
test$ = Data
a = Split(test$, ";")
a = Split(a(2), "/0/")
a = Split(a(3), "/")
' ''
Text2.Text = a(0)
Label4.Caption = a(3)
Winsock1.Close
End Sub
;User count is 9
It works but in Label4 is shows 9/good
I gotta get rid of the /good and just show 9
:(
' 2;-/-/-/-;Solaris/0/9/Good ;
Help please. thx.
Thanatos
09-03-2003, 02:33 PM
try this:
Dim a() As String
test$ = "2;-/-/-/-;Solaris/0/0/Good ;"
a = Split(test$, ";")
a = Split(a(2), "/")
MsgBox "Server: " & a(0) & " UsersOn: " & a(2)
Latac
09-03-2003, 02:35 PM
nevermyn I am an idiot, sorry folks.. I just relised I had to make it (1)
and leave it to parse "/" not "/0/"