Results 1 to 13 of 13

Thread: Winsock.ocx Question

  1. #1

    Thread Starter
    Lively Member ExciteMouse's Avatar
    Join Date
    Jul 2000
    Location
    Dallas, TX
    Posts
    78

    Question

    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


  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    How about putting a break in between sends. Like
    Winsock1.SendData ("text1" & vbCrLf)
    Winsock1.Senddata "text2"

    Laterz,
    D!m
    Dim

  3. #3
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    what about a doevents?????????????
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4

    Thread Starter
    Lively Member ExciteMouse's Avatar
    Join Date
    Jul 2000
    Location
    Dallas, TX
    Posts
    78

    Unhappy

    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

  5. #5
    New Member
    Join Date
    Jul 2000
    Location
    UK
    Posts
    4
    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

  6. #6
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    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.

  7. #7
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    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

  8. #8
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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

  9. #9

    Thread Starter
    Lively Member ExciteMouse's Avatar
    Join Date
    Jul 2000
    Location
    Dallas, TX
    Posts
    78

    Cool

    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

  10. #10
    Guest

    Smile 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

  11. #11

    Thread Starter
    Lively Member ExciteMouse's Avatar
    Join Date
    Jul 2000
    Location
    Dallas, TX
    Posts
    78

    Wink

    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

  12. #12
    Guest

    Question

    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

  13. #13

    Thread Starter
    Lively Member ExciteMouse's Avatar
    Join Date
    Jul 2000
    Location
    Dallas, TX
    Posts
    78

    Thumbs up 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
  •  



Click Here to Expand Forum to Full Width