Re: Small sockets, autorelease etc PART II
Re: Small sockets, autorelease etc PART II
- Subject: Re: Small sockets, autorelease etc PART II
- From: Dylan Barrie <email@hidden>
- Date: Sun, 26 May 2002 15:23:14 -0700
You have to use
NSLog(@"data: %@",responseString);
instead.
Dylan Barrie
On Sunday, May 26, 2002, at 02:55 PM, malcom wrote:
>
Hi again,
>
>
Wow thanx a lot to Brendan and Richard for the help!
>
Now it's all ok!
>
But when I try to call nslog to print the data...
>
>
2002-05-26 23:53:12.783 clIRC[397] data: \\304\\026\\010\\304
>
>
I think that's UNICODE...or no? How can I read well this line?
>
>
>
----------
>
This is the code (see the <<<<<<<<<< line)
>
----------
>
>
#import <Cocoa/Cocoa.h>
>
#import "Socket.h"
>
>
int main(int argc, const char *argv[])
>
{
>
Socket *socket;
>
NSString *stringa;
>
NSMutableData* response;
>
NSString* responseString;
>
>
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
>
NS_DURING
>
stringa = [NSString stringWithFormat:@"NICK daniele\n\rUSER dani . .
>
:ciao"];
>
>
// socket = [Socket socket];
>
socket = [[Socket alloc] init];
>
[socket connectToHostName: @"irc.edisontel.it" port: 6667];
>
[socket writeString: stringa];
>
>
response = [[[NSMutableData alloc] init] autorelease];
>
// [socket readData:response];
>
>
/* while ( [socket readData:response] )
>
{
>
// Read until other side disconnects
>
}*/
>
[socket readData:response];
>
responseString = [[[NSString alloc] initWithData:response
>
encoding:[NSString defaultCStringEncoding]]
>
autorelease];
>
>
NSLog(@"data: %s",responseString); <<<<<<<<<<<< THIS IS THE STRING
>
>
NS_HANDLER
>
NS_ENDHANDLER
>
return NSApplicationMain(argc, argv);
>
>
>
[pool release];
>
}
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.