f



how to receive udp multicasting packets with winsock control?

    Subject say it.  Ie I have a network adapter that has UDP 
multicasting packets coming in with destination addresses in the 
224.x.x.x range.  I'm trying to receive this data with the winsock 
control in either VB5 or VB6.  I set up the control as a UDP control, 
but no matter what I set for parameters, the dataarrival event never 
fires, even though I can see packets coming in using a freeware program 
I found. It seems like unless the packets have the IP address of my host 
computer, that winsock seems to ignore them, and windows won't let me 
change the IP# of the adapter to the 224.x.x.x range, so I am stuck.
     Someone told me that I have to "subscribe" to the multicast, but I 
have no idea of how to do this with VB.
     Can someone give me some hints on how to get started on this?
Thanks in advance.

2
wejones (9)
5/3/2004 5:04:38 PM
comp.lang.basic.visual.misc 10153 articles. 0 followers. Post Follow

4 Replies
3078 Views

Similar Articles

[PageSpeed] 50

It's no different than using them for TCP.

Here's some code I have in a couple of my programs where I'm having
one program "ping" the other one using a UDP broadcast. BTW, it's my
understanding that "broadcasts" are ONLY on IP address
255.255.255.255. You say you're using 224.x.x.x; could that be your
problem?


' set up the "Ping" server socket
PingServer.RemotePort = 7531
PingServer.Bind 7532

' broadcast this computer name to all computers on the network
PingClient.RemoteHost = "255.255.255.255"
PingClient.RemotePort = 7532

PingClient.SendData "SomeMessage"

--------------------------------------------
Private Sub PingServer_DataArrival(ByVal bytesTotal As Long)

Dim MsgIn$

PingServer.GetData MsgIn$

Do whatever needs to be done...

End Sub
--------------------------------------------

HTH

Martin
On Mon, 03 May 2004 13:04:38 -0400, Bill Jones <wejones@megalink.net>
wrote:

>    Subject say it.  Ie I have a network adapter that has UDP 
>multicasting packets coming in with destination addresses in the 
>224.x.x.x range.  I'm trying to receive this data with the winsock 
>control in either VB5 or VB6.  I set up the control as a UDP control, 
>but no matter what I set for parameters, the dataarrival event never 
>fires, even though I can see packets coming in using a freeware program 
>I found. It seems like unless the packets have the IP address of my host 
>computer, that winsock seems to ignore them, and windows won't let me 
>change the IP# of the adapter to the 224.x.x.x range, so I am stuck.
>     Someone told me that I have to "subscribe" to the multicast, but I 
>have no idea of how to do this with VB.
>     Can someone give me some hints on how to get started on this?
>Thanks in advance.

0
5/4/2004 2:22:12 AM
Martin wrote:
> It's no different than using them for TCP.
> 
> Here's some code I have in a couple of my programs where I'm having
> one program "ping" the other one using a UDP broadcast. BTW, it's my
> understanding that "broadcasts" are ONLY on IP address
> 255.255.255.255. You say you're using 224.x.x.x; could that be your
> problem?
>.......


Thanks for responding.
No, the 224.x.x.x is correct, and that is the standard "multicasting" 
address.  Ie it is "multicasting" data, NOT "broadcasting".
    I've been able to talk between computers on my network using UDP, 
but I can't get it to work with this multicasting thing.
    I have no control over the 224.x.x.x address, because that is the 
address that the data is coming in addressed to, from an external 
source.  It is actually NOAA weather data I'm trying to receive via a 
satellite signal.  I can read the data fine, using a freeware program 
called ethereal, but have been unable to read it using Visual Basic, 
using the winsock control. The data is sent out by NOAA using a 10.0.5.x 
  source address and the 224.0.x.x destination address. I've set up my 
receiving network adapter up on another 10.0.5.x address, in hopes that 
it would see the data as coming from a group computer, and in hopes that 
that would help specify the local adapter that is used to get the data, 
but that doesn't seem to help.  I think that I may have to switch to 
using winsock API, but I'm not at all familiar with doing that, which is 
why I started out trying the control.
    I have now run into an additional problem with the winsock control. 
  Ie it seems to have a mind of it's own re to what it thinks the "local 
host" is.  My computer has 3 network cards on it, and I can send out UDP 
packets out on any port, and receive them on another computer with only 
one network card, but I can't receive on the computer with 3 cards, 
since it has defaulted to the card that is only receiving multicasting 
data, and I can't change the localhost property because it is read-only.
    Is there a way to change the localhost property that the winsock 
control uses?  Anyway, I'm not having much luck with this winsock control.
Thanks.



0
wejones (9)
5/4/2004 3:24:53 PM
You're way over my head now. I told you everything I know in my first
reply. 

FWIW, a google search for "winsock multicast" yielded this link:
http://www.sockets.com/winsock2.htm  There is a sub-linked page that
talks about having to "join a group" to receive multicast messages.
Maybe this might shed some light on things for you.



On Tue, 04 May 2004 11:24:53 -0400, Bill Jones <wejones@megalink.net>
wrote:

>Martin wrote:
>> It's no different than using them for TCP.
>> 
>> Here's some code I have in a couple of my programs where I'm having
>> one program "ping" the other one using a UDP broadcast. BTW, it's my
>> understanding that "broadcasts" are ONLY on IP address
>> 255.255.255.255. You say you're using 224.x.x.x; could that be your
>> problem?
>>.......
>
>
>Thanks for responding.
>No, the 224.x.x.x is correct, and that is the standard "multicasting" 
>address.  Ie it is "multicasting" data, NOT "broadcasting".
>    I've been able to talk between computers on my network using UDP, 
>but I can't get it to work with this multicasting thing.
>    I have no control over the 224.x.x.x address, because that is the 
>address that the data is coming in addressed to, from an external 
>source.  It is actually NOAA weather data I'm trying to receive via a 
>satellite signal.  I can read the data fine, using a freeware program 
>called ethereal, but have been unable to read it using Visual Basic, 
>using the winsock control. The data is sent out by NOAA using a 10.0.5.x 
>  source address and the 224.0.x.x destination address. I've set up my 
>receiving network adapter up on another 10.0.5.x address, in hopes that 
>it would see the data as coming from a group computer, and in hopes that 
>that would help specify the local adapter that is used to get the data, 
>but that doesn't seem to help.  I think that I may have to switch to 
>using winsock API, but I'm not at all familiar with doing that, which is 
>why I started out trying the control.
>    I have now run into an additional problem with the winsock control. 
>  Ie it seems to have a mind of it's own re to what it thinks the "local 
>host" is.  My computer has 3 network cards on it, and I can send out UDP 
>packets out on any port, and receive them on another computer with only 
>one network card, but I can't receive on the computer with 3 cards, 
>since it has defaulted to the card that is only receiving multicasting 
>data, and I can't change the localhost property because it is read-only.
>    Is there a way to change the localhost property that the winsock 
>control uses?  Anyway, I'm not having much luck with this winsock control.
>Thanks.
>
>

0
5/4/2004 5:03:18 PM
Martin wrote:

> You're way over my head now. I told you everything I know in my first
> reply. 
> 
> FWIW, a google search for "winsock multicast" yielded this link:
> http://www.sockets.com/winsock2.htm  There is a sub-linked page that
> talks about having to "join a group" to receive multicast messages.
> Maybe this might shed some light on things for you.

Thanks again.  I'll look up the URL.  I found a routine for joining a 
multicast group, but it used the API, so I'll probably have to figure 
that out.
    I also found a couple VB wrappers for WinPcap, but haven't tried 
them yet.  They may be way over my head.   Thanks.



0
wejones (9)
5/4/2004 8:07:00 PM
Reply: