I am attempting to use asyncsocket to communicate GPS data from a server app on my iPhone to a client app on my macbook. The two devices connect without any problems, and when the first data is sent from the iPhone to the laptop in asyncsocket's didConnectToHost method, the data is sent without hiccup. When I subsequently try to write additional data to the laptop from the locationManager method, however, no data is written. Here is the code:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
lat = [NSNumber numberWithFloat:newLocation.coordinate.latitude];
[lat retain];
NSLog(@"lat: %1.0f", [lat floatValue]);
NSString *msg = [NSString stringWithFormat:@"%1.0f", [lat floatValue]];
NSData *msgData = [msg dataUsingEncoding:NSUTF8StringEncoding];
[listenSocket writeData:msgData withTimeout:-1 tag:0];
}
listensocket is my instance of ASyncSocket. I know that no data is being sent because after the initial successful transfer, the didWriteDataWithTag method is not called. Can开发者_如何学Go anyone explain this?
Thanks!
James
精彩评论