|
-
Jul 16th, 2000, 05:13 PM
#1
Thread Starter
Lively Member
i am not a newbie with the winsock.ocx, i know it capabilities inside and out.
That's why im here and going to ask this question.
I'm using the winsock.ocx in a control array.
i connect to the remote machine and the remote machine
sends me an 'ack' which is: "1"
now when i recieve this 'ack' i want to send back 2
SEPARATE packets, one right after the other.
so in the Winsock1 DataArrival, when i recieve the 'ack',
i send:
Winsock1(Index).SendData "text1"
Winsock1(Index).SendData "text2"
but the remote machine is recieving this:
"text1text2"
and it screws everything up.
i have tried putting a 'sleep' between the two instructions
but i still get the same thing.
and info would be appreciated!
thanks
-
Jul 16th, 2000, 05:22 PM
#2
Fanatic Member
How about putting a break in between sends. Like
Winsock1.SendData ("text1" & vbCrLf)
Winsock1.Senddata "text2"
Laterz,
D!m
-
Jul 16th, 2000, 05:43 PM
#3
Fanatic Member
what about a doevents?????????????
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 16th, 2000, 05:56 PM
#4
Thread Starter
Lively Member
nah i tried all of those too
i dont get it.. i use the SendData and it doesnt send it right away... it waits.
plah
its like its storing it in a buffer and then throwing it out when its convienient
very frustrating
-
Jul 16th, 2000, 08:10 PM
#5
New Member
I have that exact problem too, and I know how you feel, it's damned frustrating, if you've figured out a way i'd appreciate knowing, thanks
Sal
-
Jul 16th, 2000, 08:14 PM
#6
Lively Member
I have experienced a similar sort of problem. Its almost like the OS is buffering data before sending it out. Not sending when you tell it to send. The only thing I can suggest, which isnt really a fix, more a work around is to maybe manually packet your data. So put a STX and ETX on the messages you send out. Then breaking them down on the receive side.
-
Jul 17th, 2000, 02:27 AM
#7
Addicted Member
lol I have had that problem, when ummmm tryin to move the mouse on a remote computer the x and y coords were coming out at the same time, i used a pause sub
Code:
Sub Pause(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
'and then I paused for half a second:
Form1.Winsock1.SendData "Xcord:" + Text1.Text
Pause 0.5
Form1.Winsock1.SendData "Ycord:" + Text2.Text
'and it worked fine for me
-
Jul 17th, 2000, 02:46 AM
#8
PowerPoster
Right, in fact this is an error of the winsock control. I solved it with a seperator, like this:
Ws.SendData text1 & "¶"
Ws.SendData text2 & "¶"
and when receiving the data I split it up again... works fine
-
Jul 18th, 2000, 01:20 AM
#9
Thread Starter
Lively Member
Well, thanks for all your input =)
still no luck with it... i think im just going to do this with out the winsock OCX and just use direct WSock.DLL API and forget about that damned ocx alltogether.
if this were a server program i was working on i would have done it diffrently, but this is a popular program that i reverse engineered and it is imperative that the client send 2 separate packets... if i add anything in that doesnt belong the server drops me like a rotting fish =(
once again thanks alot for the ideas =)
-Mouse
-
Jul 18th, 2000, 01:43 AM
#10
comon people!
How about this (I do it to my Winsock programs)?
Before the proper message is sent, a header (predetermined fixed length string) is sent, containing data on how long the message should be (in my case, I also send the sender's name, and the type of message), when the receiving end gets it, it sets its bytesTotal to the value contained in the header, then the receiver sends a confirmation back and the transmitter will send the proper message.
Thus in the DataArrival event, as soon the the number of bytes received reaches the number defined in the header, you should do what you want to do to it, then the next message with its header will come along, as a brand new message and re-setting the bytesTotal.
Sunny
-
Jul 18th, 2000, 07:52 PM
#11
Thread Starter
Lively Member
like i said.
i can *not* add anything into the header... i cant add anything at all to this send.. it is a plain text send.. i send anything other than what is required i get dropped.
this isnt my server i'm connecting to, is someone else's
its a big company and they wont change it for me =)
thanks anyways
-Mouse
-
Jul 19th, 2000, 02:30 AM
#12
Can't you put your second send in the first winsock's SendComplete event? This doesn't change the text sent in anyway, and it sends the second one as soon as the first one is sent.
Sunny
-
Jul 19th, 2000, 02:35 AM
#13
Thread Starter
Lively Member
hmmmmmmm
that sounds like a good idea =)
its too late to try it tonight
ill try it tomarrow and let you know
thanks for that info =)
never thought of that
-Mouse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|