I find these code on the website,and rewrite it into my current code ,I can successfully connect to the server side.But I still had some problems:
outputStream:
According to the code on the website, I can normally send string
- (IBAction)sendCmd:(id)sender
{
NSString *response = @"Hello World!";
NSData *data = [[NSData alloc] initWithData:[response dataUsingEncoding:NSASCIIStringEncoding]];
[outputStream write:[data bytes] maxLength:[data length]];
}
But I want to send bytes,(e.g 0x80,0x10,0x20...etc.) Android syntax is:
byte[] buf=new byte[10];
buf[0]=(byte) 0x80;
buf[1]=(byte) 0x10;
buf[2]=(byte) 0x20;
But replaced ios,I don't know how to do? Give me some advice or website,grateful.