Reputation: 49
I have a multicast server which multicast on an IP 233.1.2.8
on some ports
I need to connect to that server directly using its actual IP do not want to use the broadcast. I want to get actual data it sends on a specific port let say
Multicast Ip 233.1.2.8 port 32334 and 35245
Actual IP 198.122.55.191 port 35366
so i want to read the data of 35366
I can see that data in CommView.exe
but can not read it if i try to connect it connects but no data
Thanks
Upvotes: 1
Views: 3425
Reputation: 1868
You can have a look at this site. It has an example also http://tack.ch/multicast/
Upvotes: 0
Reputation: 12866
You may want to rethink your question. IP packets have a source and destination address and port, so lets summarise:
You will have to open two sockets, one listening to port 32334 and one to 32335, for each socket you will have to the multicast address 233.1.2.8. That gets you a stream of packets from any host, now you have a choice:
connect()
to restrict to packets from 198.122.55.191.recvmsg()
or recvfrom()
to read each packet with the source IP address and filter the stream within your application.The last option usually requires IGMPv3 enabled network and is limited to 232.0.0.0/8 addresses.
Upvotes: 1
Reputation: 20272
Multicast by definition is one-way street: the server sends data to a group, and you subscribe to it.
Connecting to a server cannot be done through UDP, it requires a TCP server actually being there and listening for incoming connections on that particular port. The fact that that port is used for sending out multicast packets doesn't suggest that there's anyone listening on it as well.
If you want to read the data sent from a particular port - then you need to subscribe to all the groups, and analyze the UDP packets (and the IP frame if you have several servers transmitting, to know the origin IP) to see where they're coming from, and filter out the ones that come from the origin you fancy.
Upvotes: 0