• 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
Re: NSSocketPort bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSocketPort bug?


  • Subject: Re: NSSocketPort bug?
  • From: Justin Walker <email@hidden>
  • Date: Wed, 15 Dec 2004 08:53:10 -0800


On Dec 15, 2004, at 2:30, Malte wrote:

This is a kind of follow up to the thread i've started earlier asking for help in the BSD <--> Cocoa Socket thing.
I narrowed something down that looks to me like a bug, but maybe i'm just doing something wrong.
Please give me some feedback on this:


When i call:
NSSocketPort * sockPort = [[NSSocketPort alloc] initWithTCPPort:12345];
int socketFD = [sockPort socket];
NSLog(@"server socketFD: %i", socketFD);
The NSLog message gives me a positive integer (i.e. 8 in this case) just like a fileDescriptor should be


However, when i substitute the above with this:
NSSocketPort * sockPort = [[NSSocketPort alloc] initRemoteWithTCPPort:12345 host:@"192.168.1.1"];
int socketFD = [sockPort socket];
NSLog(@"server socketFD: %i", socketFD);
The socketFD is *ALWAYS* == -1 !!


Can anyone verify this? Is this a bug or am i just doing something horribly wrong?

Having no idea how to read this code, I can only guess. The default behavior of most system calls is to return -1 on errors, and provide an error code (to provide a clue as to what's wrong) in 'errno'.


Thus, I'd be tempted to see what the value of 'errno' is. You can print it as is, and look in /usr/include/sys/errno.h, or see the corresponding error string by using 'perror(char *)'.

Regards,

Justin

PS: Two requests:
1) Don't cross-post;
2) Don't use HTML or RTF in your mail; it's just plain ugly/unreadable for those who aren't configured in the same way you are. Plain text works just fine.


--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | "Weaseling out of things is what
| separates us from the animals.
| Well, except the weasel."
| - Homer J Simpson
*--------------------------------------*-------------------------------*


_______________________________________________
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


References: 
 >NSSocketPort bug? (From: Malte <email@hidden>)

  • Prev by Date: Re: Use CFRunLoop to simulate WaitForMultipleObejcts
  • Next by Date: Re: NSSocketPort bug?
  • Previous by thread: NSSocketPort bug?
  • Next by thread: Re: NSSocketPort bug?
  • Index(es):
    • Date
    • Thread