|
|
@@ -120,7 +120,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
- didNetEndIsOK(NO);
|
|
|
+ didNetEndIsOK(2);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -414,9 +414,9 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
|
|
|
}
|
|
|
|
|
|
//- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port {
|
|
|
-//
|
|
|
+//
|
|
|
// NSLog(@"didConnectToHost %d", port);
|
|
|
-//
|
|
|
+//
|
|
|
// NSThread *thread = [[NSThread alloc] initWithBlock:^{
|
|
|
// while (true) {
|
|
|
//
|
|
|
@@ -427,12 +427,12 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
|
|
|
// }];
|
|
|
//
|
|
|
// [thread start];
|
|
|
-//
|
|
|
+//
|
|
|
// /// 7. Socket 连接成功后,通过 socket 发送, self.peerPortTF 为对端服务端口
|
|
|
// //[sock writeData:[[NSString stringWithFormat:@"CONNECT 127.0.0.1:%@ HTTP/1.0\r\n\r\n", @"9100"] dataUsingEncoding:NSUTF8StringEncoding] withTimeout:-1 tag:0];
|
|
|
//
|
|
|
// NSLog(@"readDataToData");
|
|
|
-//
|
|
|
+//
|
|
|
// [cachesFileManager writeLogsWithMsg:@"didConnectToHost writeData"];
|
|
|
//}
|
|
|
//
|
|
|
@@ -442,12 +442,12 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
|
|
|
//}
|
|
|
//
|
|
|
//- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag {
|
|
|
-//
|
|
|
-//
|
|
|
+//
|
|
|
+//
|
|
|
// if (tag == 0) {
|
|
|
-//
|
|
|
+//
|
|
|
// NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
|
-//
|
|
|
+//
|
|
|
// /// 8. 收到包含 `HTTP/1.0 200`的字符串,则认为连接成功。可以正常给对端发消息了
|
|
|
// if ([str containsString:@"HTTP/1.0 200"]) {
|
|
|
// NSLog(@"Connected");
|
|
|
@@ -455,9 +455,9 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
|
|
|
//// self.connectBtn.enabled = YES;
|
|
|
//// [self.connectBtn setTitle:@"断开连接" forState:UIControlStateNormal];
|
|
|
// }
|
|
|
-//
|
|
|
+//
|
|
|
// }
|
|
|
-//
|
|
|
+//
|
|
|
// //self.revcLab.text = [NSString stringWithFormat:@"接收:%@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]];
|
|
|
//}
|
|
|
|