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

Small sockets, autorelease etc PART II


  • Subject: Small sockets, autorelease etc PART II
  • From: malcom <email@hidden>
  • Date: Sun, 26 May 2002 23:55:35 +0200

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.

  • Follow-Ups:
    • Re: Small sockets, autorelease etc PART II
      • From: Dylan Barrie <email@hidden>
  • Prev by Date: Re: [Semi-OT] "defaults write" for arrays?
  • Next by Date: Re: Small sockets, autorelease etc PART II
  • Previous by thread: Re: [Semi-OT] "defaults write" for arrays?
  • Next by thread: Re: Small sockets, autorelease etc PART II
  • Index(es):
    • Date
    • Thread