mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
try using reversed IP_MULTICAST_LOOP semantics for windows
This commit is contained in:
parent
cd27f742d4
commit
a4271b8560
1 changed files with 6 additions and 33 deletions
|
|
@ -231,48 +231,21 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname)
|
||||||
addrout.sin_addr.s_addr = ::inet_addr("225.0.0.37");
|
addrout.sin_addr.s_addr = ::inet_addr("225.0.0.37");
|
||||||
addrout.sin_port = htons (base_port);
|
addrout.sin_port = htons (base_port);
|
||||||
|
|
||||||
struct sockaddr_in any;
|
// Turn off loopback...
|
||||||
::memset(&any, 0, sizeof(struct sockaddr_in));
|
int loop = 0;
|
||||||
addrout.sin_family = AF_INET;
|
|
||||||
addrout.sin_addr.s_addr = INADDR_ANY;
|
|
||||||
addrout.sin_port = htons (base_port);
|
|
||||||
|
|
||||||
if (::bind(sockout, (struct sockaddr *) (&any), sizeof(any)) < 0) {
|
#ifdef PLATFORM_WINDOWS
|
||||||
::perror("bind");
|
const int target_sock = sockin;
|
||||||
cout << "ipmidi bind error\n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef PLATFORM_WINDOWS
|
|
||||||
int loop;
|
|
||||||
socklen_t size;
|
|
||||||
#else
|
#else
|
||||||
u_char loop;
|
const int target_sock = sockout;
|
||||||
int size;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (::getsockopt (sockout, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &loop, &size)) {
|
if (::setsockopt (target_sock, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &loop, sizeof (loop)) < 0) {
|
||||||
// ::perror ("getsockopt(IP_MULTICAST_LOOP)");
|
|
||||||
cout << "Cannot get loopback status\n";
|
|
||||||
} else {
|
|
||||||
cout << "********* 1. multicast loopback: " << loop << " size was " << size << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn off loopback...
|
|
||||||
loop = 0;
|
|
||||||
if (::setsockopt(sockout, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &loop, sizeof (loop)) < 0) {
|
|
||||||
//::perror("setsockopt(IP_MULTICAST_LOOP)");
|
//::perror("setsockopt(IP_MULTICAST_LOOP)");
|
||||||
cout << "Cannot set loopback status\n";
|
cout << "Cannot set loopback status\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (::getsockopt (sockout, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &loop, &size)) {
|
|
||||||
// ::perror ("getsockopt(IP_MULTICAST_LOOP)");
|
|
||||||
cout << "Cannot Get loopback status 2\n";
|
|
||||||
} else {
|
|
||||||
cout << "********* 2. multicast loopback: " << loop << " size was " << size << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef PLATFORM_WINDOWS
|
#ifndef PLATFORM_WINDOWS
|
||||||
|
|
||||||
if (fcntl (sockin, F_SETFL, O_NONBLOCK)) {
|
if (fcntl (sockin, F_SETFL, O_NONBLOCK)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue