Commits

Juri Pakaste committed 6bcf3df

Read reply when sending requests from the iOS app.

Comments (0)

Files changed (1)

ZeroMQTest/ZeroMQTest/ZTAppDelegate.m

 {
     NSString *msg = [NSString stringWithFormat:@"Hello from iPhone at %@", [NSDate date]];
     NSData *msgData = [msg dataUsingEncoding:NSUTF8StringEncoding];
+    NSLog(@"sending msg %@", msgData);
     if ([self.reqSocket sendData:msgData withFlags:ZMQ_NOBLOCK] == -1)
     {
         [self appendText:@"FAIL: Couldn't send request"];
     }
+    NSData *reply = [self.reqSocket receiveDataWithFlags:0];
+    NSString *replyString = [[NSString alloc] initWithData:reply encoding:NSUTF8StringEncoding];
+    [self appendText:[NSString stringWithFormat:@"REP: %@", replyString]];
 }
 
 #pragma mark - UIApplicationDelegate