|
-
Jun 16th, 2008, 09:07 AM
#1
Thread Starter
New Member
Help with the Winsock control
I have a device that broadcasts UDP multicast messages. The device has a linux based OS and a hard-coded IP address of 192.168.0.40 and according to the documentation it sends out multicast messages on 255.255.0.1 (port 10008). I have seen the messages using wireshark (ver 1.0.0). I need to write an app in VB6 (I don't have vb.net) to receive these messages but I am having trouble. I have tried using the winsock control and setting the protocol to UDP but I'm not receiving anything (or I'm doing it incorrectly). I think I may need to make some windows api calls in order to "join" a multicast group, but I'm not sure. I don't think the wireshark program is "joining" anything, it's just displaying what's on the cat5. Can anyone please make a suggestion or show an example? Thanks.
-
Jun 16th, 2008, 01:28 PM
#2
Re: Help with the Winsock control
You'll need to first bind the Winsock control on port 10008 like this:
vb Code:
Private Sub Form_Load() With Winsock1 .Bind .LocalIP, 10008 End With End Sub
Then, check the _DataArrival event to see if you are receiving any data...
vb Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim strData As String Winsock1.GetData strData, vbString, bytesTotal Debug.Print "Data (" & bytesTotal & " bytes): " & strData End Sub
-
Jun 16th, 2008, 03:52 PM
#3
Re: Help with the Winsock control
There is no support for multicast groups in the standard Winsock control. API calls might be used to accomplish this, but in general I think you'd want to look at commercial 3rd party controls.
-
Jun 17th, 2008, 01:56 PM
#4
Re: Help with the Winsock control
Hm I wasn't really sure what a multicast was...I figured if the device can send data to an IP/port then the VB program should be able to see it. Unless MultiCast is a completely different protocol other than TCP/UDP.
-
Jun 17th, 2008, 02:01 PM
#5
Re: Help with the Winsock control
Here is a multicast example in VB6 with the Winsock control. I haven't looked at its code, though:
http://www.pscode.com/vb/scripts/Sho...29005&lngWId=1
-
Jun 18th, 2008, 06:55 AM
#6
Re: Help with the Winsock control
Wow, nice find. Glad to see it doesn't take too much to make it work.
The Winsock control overwrites so many manually set sockopts I wasn't sure it was practical.
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
|