Re: NSData Question
Re: NSData Question
- Subject: Re: NSData Question
- From: Dustin Voss <email@hidden>
- Date: Thu, 9 Oct 2003 18:50:19 -0700
On Thursday, October 9, 2003, at 06:29 AM, David Dauer wrote:
Hello
I'm using an AGSocket (UDP) and want to send some data through it.
AGSocket *socket;
//...
socket = [[AGSocket udpSocket] retain];
//...
[socket writeData:data toAddress:remoteAddr];
I know what I have to do in php, there the data to send is:
"\xFF\xFF\xFF\xFFmyCommand\n"
And i know that FF is 255 in decimal in the ascii table.
My problem is that i don't know how i can add this value to the NSData
*data.
How about this:
[data append
Data:[NSData dataWithBytes: "\xFF\xFF\xFF\xFFmyCommand\n"
length: 14]];
or, better,
char *str = "\xFF\xFF\xFF\xFFmyCommand\n";
[data append
Data:[NSData dataWithBytes: str length: strlen(str) ]];
_______________________________________________
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.