Lost data with VB Winsock control and UDP GetData 
Author Message
 Lost data with VB Winsock control and UDP GetData

I have a first program which send data to a second with winsock
control over UDP protocol. The first program is able to send a serie
of message (ie more than 100) to the second which process them one at
a time.

If my first program send data to the second while it is busy
(processing the previous message), some messages are lost !
If I send 120 messages from the first prog, I get only 111 or 116 on
the second.

First prog:
-----------
For i=1 to 100
   ws.SendData "test " & i
Next

Second Prog
-----------:
Private Sub wsUDPServeur_DataArrival(ByVal bytesTotal As Long)
    Dim s As String

    ws.GetData s, vbString
    Debug.Print s

    ....
    process which last several seconds
    ....
End Sub

Result:
-------
The second program display and process only the first 111 messages.

Any idea what can I do to avoid this problem ?

Thanks.
Steph.



Sat, 14 May 2005 01:23:45 GMT  
 Lost data with VB Winsock control and UDP GetData

Quote:

> I have a first program which send data to a second with winsock
> control over UDP protocol. The first program is able to send a serie
> of message (ie more than 100) to the second which process them one at
> a time.

> If my first program send data to the second while it is busy
> (processing the previous message), some messages are lost !
> If I send 120 messages from the first prog, I get only 111 or 116 on
> the second.

> First prog:
> -----------
> For i=1 to 100
>    ws.SendData "test " & i
> Next

> Second Prog
> -----------:
> Private Sub wsUDPServeur_DataArrival(ByVal bytesTotal As Long)
>     Dim s As String

>     ws.GetData s, vbString
>     Debug.Print s

>     ....
>     process which last several seconds
>     ....
> End Sub

> Result:
> -------
> The second program display and process only the first 111 messages.

> Any idea what can I do to avoid this problem ?

> Thanks.
> Steph.

Most likely the packets are being lost entirely, although the ratio does
seem a bit high. The point of UDP is that it is unreliable - packets are NOT
guarenteed to reach their destination, so there's not much you can do...

--
Max Bolingbroke MCP
http://www.bolingbroke.net/novanet/



Sat, 14 May 2005 02:25:43 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Winsock DataArrival, socket closing and can't GetData before receiving all the data

2. Winsock.GetData how to declare storage for data?

3. Winsock control lost data

4. GetData() Method Question, Winsock Control 5.0

5. Winsock Control - Getdata does not get 100% of message

6. Help .. Winsock Control - GetData

7. Winsock Control - UDP

8. Bind method and UDP for Winsock Control

9. Winsock control and UDP to simulate DNS server

10. winsock control udp packet size limit?

11. Simple file transfer in UDP protocol using winsock control

12. Simple file transfer in UDP protocol using winsock control

 

 
Powered by phpBB® Forum Software