Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 14, 2013, 07:04 PM   #1
electricfreddy
macrumors newbie
 
Join Date: Feb 2013
GCDAsyncSockets works on some, not all iPhones

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.
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 maflynn; Feb 15, 2013 at 05:29 AM. Reason: Code tags added
electricfreddy is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
What do you think happened to Steve Jobs' personal iPhones & the Keynote iPhones? iPodJedi iPhone 4 Dec 19, 2013 07:03 PM
Do you NEED the new iPhones or WANT it? WhiteIphone5 iPhone 34 Sep 15, 2013 04:51 AM
Pre-ordered 2 iPhones. Cancelled one order. Received 2 IPhones. Tmoney0092 iPhone 11 Sep 22, 2012 09:18 AM
Need help with iPhones. Southernboyj iPhone 6 Aug 15, 2012 05:23 PM
Does iOS6 Beta3 works on non-developers iphones like beta1? krdnha iOS 6 6 Jul 22, 2012 06:51 PM

Forum Jump

All times are GMT -5. The time now is 07:12 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC