FROM : Malte
DATE : Wed Dec 15 22:56:52 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey Douglas,
thanks for your response to my post. I'm actually quite a bit irritated
and i'll let you all know why.
I have the "Cocoa in a Nutshell" by O'Reilly book (glad i didn't buy it
myself)
and one chapter touches the networking briefly. It closes with a little
bit code which implements both,
a minimalistic client and a minimalistic server.
I'll post the client code here as it is written in the book (which, by
the way, is an ADC recommended title!)
/****CODE EXCERPT FROM "COCOA IN A NUTSHELL" - O'Reilly****/
- - -(void) startClient
{
NSSocketPort * sockPort;
sockPort = [[NSSocketPort alloc]
initWithTCPPort:12345 host:@"10.0.1.3"];
int sockFD = [sockPort socket];
NSFileHandle * clientSocket;
clientSocket = [[NSFileHandle alloc]
initWithFileDescriptor:sockFD];
NSNotificationCenter * nc;
nc = [NSNotificationCenter defaultNotificationCenter]; //this should
be 'defaultCenter' instead
[nc addObserver:self
selector:@selector(processServerData:)
name:NSFileHandleReadCompletionNotifcation
object:clientSocket];
[clientSocket writeData:dataToWrite];
[clientSocket readInBackgroundAndNotify];
}
/
************************************************************************
*****/
then follows a little "processServerData" method which is irrelevant
right now.
So after reading your answer very carefully and all the research i've
done myself is this a piece of
code that could actually never work, let alone work the way that it
implies it will.
I find it somewhat absurd, that a book that is branded with the "ADC
recommended title" emblem
is demonstrating nonsensical code that in fact sends you down the wrong
alley altogether.
I guess will start digging into DO, NSStream and some publicly
available wrapper classes now or
just do it W.Richard Stevens-style myself :-(
Thanks again for your response to my problem you two! :)
- - -malte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFBwLMkOzjQTiEGtHsRAhAdAKCVwf1/zP2DneIWlr72qtFARNhQtgCfbeX2
ePDrIFVF1pzi1ImT5ZtQ5Uw=
=jcAA
-----END PGP SIGNATURE-----
DATE : Wed Dec 15 22:56:52 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey Douglas,
thanks for your response to my post. I'm actually quite a bit irritated
and i'll let you all know why.
I have the "Cocoa in a Nutshell" by O'Reilly book (glad i didn't buy it
myself)
and one chapter touches the networking briefly. It closes with a little
bit code which implements both,
a minimalistic client and a minimalistic server.
I'll post the client code here as it is written in the book (which, by
the way, is an ADC recommended title!)
/****CODE EXCERPT FROM "COCOA IN A NUTSHELL" - O'Reilly****/
- - -(void) startClient
{
NSSocketPort * sockPort;
sockPort = [[NSSocketPort alloc]
initWithTCPPort:12345 host:@"10.0.1.3"];
int sockFD = [sockPort socket];
NSFileHandle * clientSocket;
clientSocket = [[NSFileHandle alloc]
initWithFileDescriptor:sockFD];
NSNotificationCenter * nc;
nc = [NSNotificationCenter defaultNotificationCenter]; //this should
be 'defaultCenter' instead
[nc addObserver:self
selector:@selector(processServerData:)
name:NSFileHandleReadCompletionNotifcation
object:clientSocket];
[clientSocket writeData:dataToWrite];
[clientSocket readInBackgroundAndNotify];
}
/
************************************************************************
*****/
then follows a little "processServerData" method which is irrelevant
right now.
So after reading your answer very carefully and all the research i've
done myself is this a piece of
code that could actually never work, let alone work the way that it
implies it will.
I find it somewhat absurd, that a book that is branded with the "ADC
recommended title" emblem
is demonstrating nonsensical code that in fact sends you down the wrong
alley altogether.
I guess will start digging into DO, NSStream and some publicly
available wrapper classes now or
just do it W.Richard Stevens-style myself :-(
Thanks again for your response to my problem you two! :)
- - -malte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFBwLMkOzjQTiEGtHsRAhAdAKCVwf1/zP2DneIWlr72qtFARNhQtgCfbeX2
ePDrIFVF1pzi1ImT5ZtQ5Uw=
=jcAA
-----END PGP SIGNATURE-----
| Related mails | Author | Date |
|---|---|---|
| Malte | Dec 15, 11:30 | |
| João Pavão | Dec 15, 15:03 | |
| Douglas Davidson | Dec 15, 21:42 | |
| Malte | Dec 15, 22:56 | |
| Dustin Voss | Dec 16, 04:25 |






Cocoa mail archive

