Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multicast recv problem XP

73 views
Skip to first unread message

kace

unread,
May 5, 2010, 12:18:05 PM5/5/10
to
Hello

I am using ACE 5.6 on windows XP SP2 VC8. I am using the example send
and recv multicast by Umar Sayyid. The sending seems to work but the
recv does not get any messages. The same code works on Windows 2003
server.

What am I missing ?

Thanks In Advance.
-K

testsend

#include "stdafx.h"

#define DEFAULT_MULTICAST_ADDR "239.239.100.2"
#define TIMEOUT 5
#include "ace/SOCK_Dgram_Mcast.h"
#include "ace/Log_Msg.h"
#include "ace/OS.h"

class Sender_Multicast{
public:
Sender_Multicast(int port):
local_addr_((u_short)0),
multicast_addr_(port,DEFAULT_MULTICAST_ADDR),dgram_(local_addr_){}
/*{
if( dgram_.join(multicast_addr_,1,NULL) == -1) {
printf(" Problem with join %d\n", ACE_OS::last_error());
}
}*/

//Method which uses a simple datagram component to send data to the
multicast group.
int send_to_multicast_group(){
//Convert the information we wish to send into network byte order
mcast_info= htons (1000);

for(int i = 0; i<10;i++) {
// Send multicast
if(dgram_.send
(&mcast_info, sizeof (mcast_info), multicast_addr_)==-1)
return -1;

printf( "%s; Sent multicast to group. Number sent is %d.\n",
__FILE__,
mcast_info);
Sleep(1000);
}
return 0;
}

private:
ACE_INET_Addr multicast_addr_;
ACE_INET_Addr local_addr_;
//ACE_SOCK_Dgram_Mcast dgram_;
ACE_SOCK_Dgram dgram_;
int mcast_info;
};

int _tmain(int argc, _TCHAR* argv[])
{
WORD wVersionRequested;
WSADATA wsaData;
int err;

/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
int num = 1;
wVersionRequested = MAKEWORD(2, 2);
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
/* Tell the user that we could not find a usable */
/* Winsock DLL. */
printf("WSAStartup failed with error: %d\n", err);
return 1;
}

Sender_Multicast m(60003);
if(m.send_to_multicast_group()==-1) {
printf("Send to Multicast group failed \n");
exit(-1);
}
else
printf("Send to Multicast group succesful \n");
return 0;
}


testrecv

#include "stdafx.h"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// This example is from the ACE Programmers Guide.
//// Chapter: "IPC SAP" (Interprocess Communication Mechanisms in
ACE).
//// For details please see the guide at
//// http://www.cs.wustl.edu/~schmidt/ACE.html
//// AUTHOR: Umar Syyid (usy...@hns.com)
//// and Ambreen Ilyas (amb...@bitsmart.com)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Example 5
#include "ace/SOCK_Dgram_Mcast.h"
#include "ace/OS.h"
#include <iostream>
#define DEFAULT_MULTICAST_ADDR "239.239.100.2"
#define TIMEOUT 5

using namespace std;
class Reciever_Multicast{

public:
Reciever_Multicast(int port):
mcast_addr_(port,DEFAULT_MULTICAST_ADDR),remote_addr_((u_short)0)
{//,mcast_dgram_((ACE_SOCK_Dgram_Mcast::options)
(ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_YES|
ACE_SOCK_Dgram_Mcast::DEFOPT_NULLIFACE)){
ACE_INET_Addr* addr_ary;
size_t number;
if( ACE::get_ip_interfaces(number,addr_ary) == -1)
std::cout << "Error getting interfaces " << number << std::endl;
else
for(size_t i = 0; i<number;i++)
std::cout << addr_ary[i].get_host_name() << ":" <<
addr_ary[i].get_ip_address() << std::endl;

// Subscribe to multicast address.
if (mcast_dgram_.join(mcast_addr_) == -1){
int err = ACE_OS::last_error();
std::cout << "Error in subscribing to Multicast address " << err <<
std::endl;
exit(-1);
}

std::cout << " Dumping information" << std::endl;
mcast_dgram_.dump();
std::cout << " done Dumping information" << std::endl;
}

~Reciever_Multicast(){
if(mcast_dgram_.unsubscribe()==-1)
std::cout << "Error in unsubscribing from Mcast group\n?";
}

//Receive data from someone who is sending data on the multicast
group
//address to do so it must use the multicast datagram component
//mcast_dgram_.
int recv_multicast(){
//get ready to recieve data from the sender.
if(mcast_dgram_.recv
(&mcast_info,sizeof (mcast_info),remote_addr_)==-1)
return -1;
printf( "(%P|%t) Received multicast from %s:%d.\n",
remote_addr_.get_host_name(), remote_addr_.get_port_number());
printf("Successfully receieved %d\n", mcast_info);
return 0;
}

private:
ACE_INET_Addr mcast_addr_;
ACE_INET_Addr remote_addr_;
ACE_SOCK_Dgram_Mcast mcast_dgram_;
int mcast_info;
};

int _tmain(int argc, _TCHAR* argv[])
{
WORD wVersionRequested;
WSADATA wsaData;
int err;

/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
int num = 1;
wVersionRequested = MAKEWORD(2, 2);
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
/* Tell the user that we could not find a usable */
/* Winsock DLL. */
printf("WSAStartup failed with error: %d\n", err);
return 1;
}
Reciever_Multicast m(60003);
//Will run forever
while(m.recv_multicast()!=-1) {
printf("Multicaster succesful \n");
}

Douglas C. Schmidt

unread,
May 5, 2010, 12:51:55 PM5/5/10
to ksa...@gmail.com, ace-...@cse.wustl.edu
Hi,

>I am using ACE 5.6 on windows XP SP2 VC8.

You are using an old version of ACE. Please upgrade to ACE+TAO+CIAO
x.7.8 (i.e., ACE 5.7.8, TAO 1.7.8, and CIAO 0.7.8), which you can
download from

http://download.dre.vanderbilt.edu

under the heading: "Latest Micro Release Kit."

The DOC group at Vanderbilt University only provides "best effort"
support for non-sponsors for the latest release, as described in

http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/docs/ACE-bug-process.html

Thus, if you need more "predictable" help for earlier versions of
ACE+TAO, I recommend that you check out

http://www.dre.vanderbilt.edu/support.html

for a list of companies that will provide you with ACE+TAO commercial
support.

> I am using the example send
>and recv multicast by Umar Sayyid. The sending seems to work but the
>recv does not get any messages. The same code works on Windows 2003
>server.
>
>What am I missing ?

You probably don't have multicast configured properly on your windows
XP SP2 machine. I recommend you chat with your sys admin since it's
unlikely that this problem has anything to do with ACE.

Thanks,

Doug


--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.sc...@vanderbilt.edu

kace

unread,
May 5, 2010, 7:37:57 PM5/5/10
to
On May 5, 12:51 pm, schm...@dre.vanderbilt.edu (Douglas C. Schmidt)
wrote:

> Hi,
>
> >I am using ACE 5.6 on windows XP SP2 VC8.
>
> You are using an old version of ACE.  Please upgrade to ACE+TAO+CIAO
> x.7.8 (i.e., ACE 5.7.8, TAO 1.7.8, and CIAO 0.7.8), which you can
> download from
>
> http://download.dre.vanderbilt.edu
>
> under the heading: "Latest Micro Release Kit."
>
> The DOC group at Vanderbilt University only provides "best effort"
> support for non-sponsors for the latest release, as described in
>
> http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/docs/ACE-bug-proc...
> >//////////////////////////////////////////////////////////////////////////­///////////////////////////////////////

> >//// This example is from the ACE Programmers Guide.
> >////  Chapter: "IPC SAP" (Interprocess Communication Mechanisms in
> >ACE).
> >//// For details please see the guide at
> >////http://www.cs.wustl.edu/~schmidt/ACE.html

> >////  AUTHOR: Umar Syyid (usy...@hns.com)
> >//// and Ambreen Ilyas (ambr...@bitsmart.com)
> >//////////////////////////////////////////////////////////////////////////­///////////////////////////////////
> Nashville, TN 37203                          NET: d.schm...@vanderbilt.edu- Hide quoted text -
>
> - Show quoted text -


Thank you. I will dowload the new version in the near future. I did
find the problem though.
I had established a VPN connection to another server. Once I
disconnected the VPN connection, I was able to receive the multicast
packets.
I have not figured out how this affects the multicast.
-K

Douglas C. Schmidt

unread,
May 5, 2010, 8:08:50 PM5/5/10
to Kiran Devanath, ace-...@cse.wustl.edu

Hi Kiran,

> Thank you. I will dowload the new version in the near future. I did

> find the problem. I had established a VPN connection to another
> server. Once I rebooted my machine the VPN connection was gone. I was
> able to reveive the multicast packets.

Ok, super, thanks for letting us know!

Doug

0 new messages