• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
PeerToPeer Replications using bonjour not working with IPV6 addresses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PeerToPeer Replications using bonjour not working with IPV6 addresses


  • Subject: PeerToPeer Replications using bonjour not working with IPV6 addresses
  • From: Br Achar <email@hidden>
  • Date: Fri, 17 Oct 2014 13:41:23 +0530
  • Importance: Normal

Hi ,

We are developing an iOS application for ipad that uses bonjour for conneting with other devices and couchbaseListener for replications with peer databases. We have observed that whenever [nsnetservice addresses] returns IPV6 address ,replication is not suuccesful.We have tried encoding IPV6 last two components sayfe80::68c8:cfff:fef9:3856 as 254.249.56.86 and using the same in the url but still replications fail.

 

We get the IPV4 address only when bluetooth is switched on randomly i.e 1 out of 5 times.In other cases ,Peer-Peer Wifi and Infrastructure Wifi only IPV6 address is returned.

In addition to that, [NSNetService addresses] returns only one address from the array.

 

Is it possible in some proper way to convert IPV6 address to IPV4 address and use the same or else retrieve the IPV4 address?

 

Please find the code used for converting to Ip address below.

 

char addressBuffer[INET6_ADDRSTRLEN];

for (NSData *data in self.addresses) {

memset(addressBuffer, 0, INET6_ADDRSTRLEN);

typedef union {
   
struct sockaddr sa;
   
struct sockaddr_in ipv4;
   
struct sockaddr_in6 ipv6;
} ip_socket_address;

ip_socket_address
*socketAddress = (ip_socket_address *)[data bytes];

if (socketAddress && (socketAddress->sa.sa_family == AF_INET || socketAddress->sa.sa_family == AF_INET6))
{
   
const char *addressStr = inet_ntop(
            socketAddress
->sa.sa_family,
           
(socketAddress->sa.sa_family == AF_INET ? (void *)&(socketAddress->ipv4.sin_addr) : (void *)&(socketAddress->ipv6.sin6_addr)),
            addressBuffer
,
           
sizeof(addressBuffer));

   
int port = ntohs(socketAddress->sa.sa_family == AF_INET ? socketAddress->ipv4.sin_port : socketAddress->ipv6.sin6_port);

   
if (addressStr && port)
   
{
       
NSLog(@"Found service at %s:%d", addressStr, port);
   
}
}
Please help .

Thanks & Regards
Lakshminarayana Achar B R
Tata Consultancy Services
Cell:- 9940021554
Mailto: email@hidden
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: PeerToPeer Replications using bonjour not working with IPV6 addresses
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Prev by Date: What's the best way to run an NSURLProtocol session?
  • Next by Date: Re: What's the best way to run an NSURLProtocol session?
  • Previous by thread: Re: What's the best way to run an NSURLProtocol session?
  • Next by thread: Re: PeerToPeer Replications using bonjour not working with IPV6 addresses
  • Index(es):
    • Date
    • Thread