I'm Using NSOutputStream to Output data from the client (IOS device ) to the server (PC Device). I can send data successfully to the server, I just want to add the Current Time using NSOutputStream.
How can i send the current time using NSOutputStream?
Here's my code
- (IBAction)button1:(id)sender {
NSString *response = @" Today's Sunny \n ";
NSData *data = [[NSData alloc] initWithData:[response dataUsingEncoding:NSASCIIStringEncoding]];
[outputStream write:[data bytes] maxLength:[data length]];
NSDate *currentTime = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"hh:mm:ss"];
_timer.text = [formatter stringFromDate:currentTime];
//_timer is A label just for testing
///I'm trying to use outputStream to output currentTime like this
/// [outputStream write:[currentTime bytes] maxLength:[CurrentTime length]];
}