Code:Private Sub Socket_DataArrival(ByVal bytesTotal As Long) Dim Buffer() As Byte, I%, Y%, X%, FirstPos As Boolean, ParseString$ Socket.GetData Buffer, vbByte + vbArray For I = LBound(Buffer) to UBound(Buffer) IF FirstPos =True then IF Buffer(I) = 53 and Buffer(I+1) = 192 and Buffer(I+2) = 128 then Y = I FirstPos = False Exit For End If IF Buffer(i) = 192 and Buffer(I+1)=128 Then X = I + 2 FirstPos = True End IF Next I For I = X to Y ParseString = ParseString & chr(Buffer(i)) Next I End Sub
Is There any Better and Faster Way to Do this?
Thankx for the Help
P.S. Some People might ask why don't use String instead of Byte?
Coz in some Lang. Don't support string with chr(129 to 254) it will return chr(0).




Reply With Quote