Hello:
I have the code posted below (mostly cut right out of an example on GitHub) working well on an Iphone 3 with 5.0, and an iPod iTouch running 6.0. But it fails to write on another iPhone 3 with 6.0. Are there some settings I need to enable under "Settings" to enable sockets? The non writing phone can reach the host on its Safari browser so it doesn't seem to be a connectivity issue. All the rest of the software in question works on all phones.
here's the code that works on 2 devices and not on the third.
------------------
Thx in Advance
I have the code posted below (mostly cut right out of an example on GitHub) working well on an Iphone 3 with 5.0, and an iPod iTouch running 6.0. But it fails to write on another iPhone 3 with 6.0. Are there some settings I need to enable under "Settings" to enable sockets? The non writing phone can reach the host on its Safari browser so it doesn't seem to be a connectivity issue. All the rest of the software in question works on all phones.
here's the code that works on 2 devices and not on the third.
Code:
//next is attempt to implement GCDAsyncSockets 2/4/2014 build 0.9.589
GCDAsyncSocket *socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
NSError *err = nil;
if (![socket connectToHost:ipAddress.text onPort:9100 error:&err]) // Asynchronous!
{
// If there was an error, it's likely something like "already connected" or "no delegate set"
NSLog(@"I goofed: %@", err);
}
outputData = [[NSData alloc] initWithData:[response dataUsingEncoding:NSASCIIStringEncoding]];
[socket writeData:outputData withTimeout:-1 tag:1];
Thx in Advance
Last edited by a moderator: