Results 1 to 3 of 3

Thread: Winsock - Testing whether data is being sent.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    11

    Question

    Hi,

    Anyone know how to test to see whether data is being sent through a winsock control?

    For example:

    Private Sub cmdSendData_Click()
    Winsock1.SendData "Hello, please help me"
    End Sub

    Private Sub cmdSendMoreData_Click()
    If Winsock1 <> Sending Data Then
    Winsock1.SendData "Ok"
    Else
    MsgBox "Data is currently being sent."
    End If
    End Sub

    Anyone know how to do the 'If Winsock1 <> Sending Data Then' bit?

    Thanks a lot
    /Nick

  2. #2
    New Member
    Join Date
    May 2000
    Posts
    11

    Exclamation Well, There's a way... but u won't like it.

    When i was writing my peer-to-peer file server, i just declared a whole crapload of booleans...

    (GEN DECS)
    DIM SENDDATA AS BOOLEAN

    Then all you have to do is trigger the boolean

    (WHEN SENDING THE DATA)
    LET SENDDATA = TRUE
    WINSOCK1.SENDATA DATA
    ...

    After that you use the winsock control's "send complete" event

    (WINSOCK1 - SENDCOMPLETE EVENT SUB)
    IF SENDDATA = TRUE THEN LET SENDDATA = FALSE

    ...This may seem all well and good if you have 1 or two data exchanges that you need to check on, but when you get up to about 12 the whole thing becomes un-manageable.

    If anyone has a better way of doing this then LET ME KNOW VIA E-MAIL... PLEASE!
    "Beyond the pretty wrapping paper, all life is, is just a struggle between one hard spot and the next, puncuated by a failure of biological systems."- Codewarrior123

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Thumbs up Winsock Events

    Hi! Lympex, why not juz make used of the existing Winsock1_SendComplete() and Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long) events in the Winsock control? I think this can resolve your problem right.

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