• 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: Small sockets, autorelease etc PART II
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Small sockets, autorelease etc PART II (From: malcom <email@hidden>)

  • Prev by Date: Small sockets, autorelease etc PART II
  • Next by Date: Need to subclass NSTextView or not
  • Previous by thread: Small sockets, autorelease etc PART II
  • Next by thread: Need to subclass NSTextView or not
  • Index(es):
    • Date
    • Thread