0

We have a sensor on our local network that is sending a data telegram using UDP Broadcast. How do we use Winsock to capture these messages.

The Port number that the data is being sent on is 42567.

I tried the following code

WinSockControl.Protocol = sckUDPProtocol
WinSockControl.RemotePort = 42567
WinSockControl.Bind

When stepping through this code in the IDE it accepts all these commands however it ver triggers the WinSockControl.DataArrival.

Can anyone tell me what I am doing wrong. I assumed that as the data is being broadcast around my subnet all I need to do is listen.

Thank You

Edited by Dani: Formatting fixed

3
Contributors
7
Replies
26
Views
4 Years
Discussion Span
Last Post by TnTinMN
0

sorry the above should have said it never triggers the WinSockControl.DataArrival

0

Please show is all the code where you ask the sock to listen for data and where you catch the arrival of said data.

0

For the test application on the form load I run the following code.

WinSockControl.Protocol = sckUDPProtocol
WinSockControl.RemotePort = 42567
WinSockControl.Bind

I then use the following routine to handle the incoming message. This routine never triggers.

Private Sub WinSockControl_DataArrival(ByVal bytesTotal As Long)
  Dim DataMessage As String
  WinSockControl.GetData DataMessage
End Sub

What am I doing wrong ?

Thanks for your help

JK

Edited by Dani: Formatting fixed

0

The problem seems to be with your server side of the app where the data gets send. If the event does not trigger on the arrival side, it means that it is not receiving anything at all, staying in a static status. What code do you have on the serverside?

0

We are using a commercial test application to send the message. Using CommView to monitor Port activity we can see the UDP message appearing on Port 42567 and showing the data telegram we expect. But the VB6 application doesn't seem to read it.

0

Mmmm. gonna have to scratch some head here. Haven't used winsock for ages. I'll search and see what I can get from my old apps or online.

Edited by AndreRet

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.