-
I have a little problem using Winsock. I am using it to send a keystrokes - a single bytes representing ASCII codes. When you are typing (very) slowly, it works. But when you type more quickly, the I have troubles on client (maybe) side - the characters are higgledy-piggledy sorted, sometimes the whole groups of characters.
I tried to use something like this:
Code:
Sub Winsock1_DataArrival....
Winsock1.GetData d, vbArray+vbByte
Do While Recieving
Doevents
Loop
Recieving = True
...
Recieving = False
But this doesn't helped. How to get the right order, even they are quickly sent?
-
try this
comp 1
text1_keypress(keyascii as integer)
sock.senddata str(keyascii)
end sub
comp 2
sock_dataarrival
sock.getdata strIn
sendkeys strIn
-
Yeh, I though about this, but I need to send a virtual keys too...
-
Why not make up your own protocol
$K=Press the space
etc
-
The protocol is good idea. It works well; but...
I tried to send the keys as strings - no change, the some letters are on ohter place than yhte :) should be.
-
Hi,
Your caracters are sorted in the wrong order because of your DOEVENT... What I think is that the event is trigged a couple times and some of them are processed in the doevent inside the first event.
Try it without the doevent...
What is the scope of "D", global probably.
Also I can see you are using arrays of bytes...the best way to use getdata is with a string datatype.
The general idea is that the getdata only contains something like this :
winsock sub
dim sTemp as string
getdata sTemp
d = d & sTemp
end sub
AND you in a timer or something like this process the "d" variable
E-mail me if you want more info on this I think I got it pretty clear in my mind.
P.S. I've used Winsocks a lot and I'am convinced it should be spelled Winsuck as well as it's creator Microsucks :-)