Re: SCTP. V4 v. V6 addresses... / comparing identies
Re: SCTP. V4 v. V6 addresses... / comparing identies
- Subject: Re: SCTP. V4 v. V6 addresses... / comparing identies
- From: J P May <email@hidden>
- Date: Mon, 2 Aug 2010 14:13:14 +0200
On my Mac, which is a relatively stock setup, I get this pretty much
every time..
This happens because the listen listens on IPv4 and IPv6
simultaneously. I verify this with netstat..
Ahh, thanks. I tried it on the same machine (i.e., with localhost)
and indeed I got "Point A" action. Thanks.
However - I now tried a couple mac-to-mac connections (different macs
over wifi) and I still get "non-A" action only. I will try further.
You don't, perchance, have IPv6 disabled on your machine?
I don't think so; perhaps it's something to do with the routers I
have tried (?). Anyway thanks for the tips, I will look in to it
further.
iOS 4 supports IPv6 in much the same way as Mac OS X does.
Ah, I had no idea, great tip, thanks.
Here's an interesting question: You're a server and some data
arrives, perhaps something like this in the "UDPEcho" example,
- (void)echo:(UDPEcho *)echo didReceiveData:(NSData *)data
fromAddress:(NSData *)addr
First you determine which of your current connections, the data is
from. So to discombobulate the hostname and port ... the only way I
know to do that is with getnameinfo. In the example,
char sentFromHost[NI_MAXHOST];
char sentFromService[NI_MAXSERV];
getnameinfo( [addr bytes], (socklen_t) [addr length],
sentFromHost, sizeof(sentFromHost),
sentFromService, sizeof(sentFromService),
NI_NUMERICHOST | NI_NUMERICSERV);
then you would say something like
thisConnectionIsFrom = findIt( arrayOfExtantConnections, sentFromHost )
and Bob's your Uncle. There's no problem with that, but,
(minor question) is it true that using getnameinfo would reliably
distinguish between connections EVEN IF you have a mixed bag of IPV4
and IPV6 connections?
Or, do you have to *separately* search through your IPV4 and IPV6
connections !? ie, something like this:
if ( styleOfThisConnection == IP4 )
thisConnectionIsFrom = findItAmidstTheFours( sentFromHost )
else // IP6
thisConnectionIsFrom = findItAmidstTheSixes( sentFromHost )
(major question) Moreover, is there a quicker way to just plain
directly compare the bytes in "struct addr" type data? it's
confusing because the different protocol versions seem to use
different lengths (as far as I can make out) of data storage.
Is there some common idiom in use by network programmers, like...
if ( (UInt999 *)address == (UInt999 *)slot1 ) // it's a match!
that I don't know about? ie just directly comparing the memory somehow?
Cheers!
_______________________________________________
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