How do you determine when to use a LAN or a PUBLIC IP for connections?

I'm using CFStreamCreatePairWithSocketToHost to connect to a server.
I have a public IP address of example.dyndns.com which points to my home office router.
On my home office router I forward port 1234 to a specific server (192.168.2.55)
That specific server runs a service offering data etc. to an iPhone app.
When I am away from the office I user CFStreamCreatePairWithSocketToHost to connect to example.dyndns.com.
No problem. Connection is made and everything runs lovely.
When I am in the office and on the lan however - the connection fails. Basically the packet goes out to the router, or to dyndns, u turns and comes back but doesn't get forwarded to 192.168.2.55.
If I change the code to point to 192.168.2.55 of course it runs fine, but then won't run when I am not on wifi in the office of course.
Is there an elegant way to deal with this? The router has no configurable options that I am able to identify to allow this u-turn type of traffic.
I could I suppose on startup test a connection, then in the stream event handler flip it from WAN to LAN IP on a failure. But that's very combersome - it doesn't easily allow an office user to drop in and out of the office wifi transparently (sure they could kill then restart the app but that's just plain ugly).
Any feedback/sample code people can offer would be appreciated. :-)
Dave.

Llessur999 wrote:
That is a reasonable approach. Without changing network configuration, I don't see an alternative. A few considerations:
Based on your experience, will the length of time to detect unreachability (a network timeout?) cause a usability issue?
Must you support a scenario where a user transitions LAN-to-WAN or WAN-to-LAN while using the app?
If this is used by a wide audience, will configuring the primary/fallback be straightforward?
I don't think there's a usability issue.
Yes. The app is designed for a brick/mortor location that essentially wants to drive the user to the location. The user has to ability to interact with specific hardware components at the location via server/port communications - some of which they can do while they are remote. While they are on location, they need to retain that ability to interact with local equipment even more. Users could be asked to not go on the location wifi of course but that just seems silly and an overall bad user experience.
The primary/fallback configuration should all be done within code (no user interaction). For example the WAN IP will always be X.X.X.X (be it Public IP or dyndns - makes no difference), while the LAN configuration will always know that the lan server it needs to communicate will always be at a specific LAN IP (192.168.x.x).
It would be  godsend to have some sort of API call (or class) that can accept a call to CFStreamCreatePairWithSocketToHost to a specific IP and on seeing that it's unreachable automatically try the secondary IP before returning a failure on the stream.

Similar Messages

  • How do you determine file being used in DVD map?

    Hi
    On older idvd projects I sometimes want to check what version of a movie file it is using. I can't figure out how to reveal the information. Specifically, I'm looking for exact name of file being used and its location.
    Thank you for your help
    Phil

    You can find that information from within the iDVD project. Open the iDVD project in question. Under the menu bar, select Project Info. You will then see a screen containing information about that project. There is a screen showing all the Media used, with the path to each movie, audio, or photo used in the project. The path begins with the drive on which the movie is located and then each folder/file.
    By the way, you do know that an iDVD project is like an alias collection. The actual media are not stored within the project, only information pointing to the actual media files. When you burn a DVD, iDVD gathers the media files temporarily for the burn.
    If you rename, move, change or delete any media used within a project, iDVD will be unable to locate the files and will not open properly. Many people have mistakenly saved only an iDVD project, deleting the original iMovies used in it, and have been sadly disappointed to find that the iDVD project no longer has the movie files.
    If you wish to save drive space but save your iDVD projects for burning later, you should create a disk image file by doing 'save as disc image' from within your iDVD project. This process looks just like a burn, and the encoding takes just as long, but the end result is a disk image file, not a burned DVD disk. The disk image file is self-contained; that is, all the media files used in the project are encoded into the disk image file. So now you have a disk image file of your project that can be saved, moved, used to burn DVD disks at any time.
    You can safely delete the original iMovie project and the original iDVD project without losing the capability of burning more DVDs of the project.
    I have disk image files of all the iDVD projects I have made. I store them on external drives as backups.

  • How do you determine when certificates will expire?

    I recently started at a company and my predecessor left no information on licenses and certificates. I need to determine when the certificates expire so I can be prepared to update them with limited downtime.

    If we are talking about the application server SSL certs, then by opening the adminui with https in browser, click on lock icon (In Firefox, More Information -> View Certificate ) as below :
    Check out Expires on field.
    Hope this helps.
    Thanks,
    Wasil

  • How can you determine a file creation date and know if it's been altered since the creation date

    I need to know how to determine a file creation date on an ipad.  If someone creates a document/note on an ipad how can you tell when it was created and if it has been altered since?

    Unless you are using a third party app that provides that functionality, in iOS the only thing youcan access is the last edit/save date and time, which is fairly evident in the user interface for documents and notes. Some apps that handle MS Office files may provide that, but ican't say first hand.

  • How do you determine transportation planning point

    Hi Gurus,
    Badly need your help.  How do you determine transportation planning point?
    Thanks,
    Paul

    Dear John
    It is based on routes and route schedules are determined based on the following conditions:-
    => Shipping point
         Where are the goods coming from?
    => Ship-to party and unloading point
         Where are the goods going to?
    => Shipping condition
         How are the goods being shipped?
    => Transportation group
         Which goods are shipped?
         --> For example, which type of goods?
    => Calendar week / year
          When are the goods to be shipped?
    If you do not explicitly enter the week and the year, the entry applies for each calendar week. If you enter a week and a year, the route schedule only applies for this week.
    You can only use route schedules if you have maintained the working times and therefore at least one of the following times in minutes:
           -> Transportation planning time
           -> Pick/pack time
           -> Loading time
           -> Transit time
    A route schedule can leave the warehouse exactly once in a week. If a route schedule runs several times, either on several days or several times a day, it must be copied to another route schedule.
    Thanks
    G. Lakshmipathi

  • HT201209 How do you determine the funds left on an itunes card?

    How do you determine the funds left on an itunes card?

    If it hasn't been redeemed, the value is the face value.
    If it was redeemed, the value on the card is zero. 
    When you redeem an iTunes gift card, the full value is immediately transferred as a credit to the account you are using when you do the redemption.  After that point, the card is worthless.

  • On IOS 7, how can you tell when your battery is charging for your phone?

    on IOS 7, how can you tell when your battery is charging for your phone?

    thanks everyone=you all helped.
    I wasn't used to not getting the 2 sided plug- now I know I am ok>
    **hugs**

  • How do you determine the optimal size for Mozilla Firefox?

    How do you determine the optimal size for cache in Mozilla
    Firefox? I am using Firefox 7.0.1 on a 64-bit Windows 7 Ultimate operating system with 3GB RAM and 300 GB hard drive, but I have other computers running Windows XP. If the answer doesn't apply to all current versions of Firefox on all supported Windows operating systems, please explain the differences. Is there a formula for calculating the best cache size?

    I found that the best idea is to let Firefox decide that itself.

  • How do you determine the picture that is shown on iTunes for your podcast?

    How do you determine the picture that is shown on iTunes for your podcast? Is that done in iWeb or Garagetunes?

    That is a supported format,
    Pull the battery while the device is ON, replace after a minute, Let the device reboot 1-3 min,
    see if the problem is fixed,
    If not we may have to reload the device OS to get back the missing option.
    Thanks,
    If you need more info please ask!  If not please resolve the thread using the options by the Kudos’ star, Just place the check in the Post that answered your question, Thanks
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • How do you know when your MacBook is infected?

    Hey All. Well my question is how do you know when your MacBook is infected with a virus? I came off windows and i have norton antivirus so i have something to tell me there. But on the Mac OS you rarely get viruses and i dont have a anitvirus program, so how do you know when you have one? And what does it do?
    Thanks!

    Since no ones got one that I know of it is hard to say. I figure that when the day comes that someone writes a Mac virus you will know real quick what happens. If your concerned you could use ClamXav. I use it if I download something for my wife's PC but have never found anything yet.

  • How do you Determine the Largest Size/Fastest Speed Hard Drive

    In general, how do you determine the maximum hard drive size/speed you can upgrade to?

    As long as the drive your are considering physically fits as already stated there is no maximum size you can install. Please complete your profile so we know what machine you have.
    If your machine is covered by a warranty or AppleCare I would recommend against installing another HD as this may invalidate the warranty. I would recommend in that case using a Firewire 800 external HD instead.
    Regards,
    Roger

  • How do you determine which programs or processes run following a reboot?

    How do you determine which programs or processes run following a reboot?  Also when you reboot Mac tries to reopen anything running before the reboot.  Is there any way to turn off that functionality?

    10.7 Lion
    dadpope wrote:
    How do you determine which programs or processes run following a reboot?
    Login items
    Follow the  instructions in this article.
    http://support.apple.com/kb/PH4333
    Also when you reboot Mac tries to reopen anything running before the reboot.  Is there any way to turn off that functionality?
    System Preferences > General
    Section: Number of recent items
    Uncheck the box for "Restore windows when quitting and re-opening apps".

  • Hi there, can anyone tell me how to make make Garageband ignore HDMI as an audio output-device on a 2013 Mac Mini? Now it keeps on prompting me: Do you want want to use the HDMI device (monitor without audio) for audio output? Thanks in advance, Grtz T.

    Hi there,
    Can anyone tell me how to make make Garageband ignore HDMI as an audio output-device on a 2013 Mac mini i7 using an Apogee jam as an input for bass and a Behringer USB DAC with RCA audio output? Now it keeps on prompting me: Do you want want to use the HDMI device (monitor without audio) for audio output? I'm also suffering massive audio lag issues with the Apogee jam after waking the mini from sleepmode, wich pretty much renders it useless.
    Thanks in advance,
    Grtz T.

    I think the easiest way to do this is to have the EyeTV app running in one user account and sent via HDMI to the TV, and use a separate user account for Screen Sharing. Both logins can be active at the same time and with Lion you can connect via screen sharing to which ever login you need.
    With regards to the Mac video resolution changing, when it is not the current input on your AV receiver. This is 'normal', if the Mac sees no signal it drops down the a lower level. What you need is to buy a HDMI Detective Plus which tricks the Mac in to always seeing a signal and hence it will not drop down the resolution. See http://www.gefen.com/kvm/dproduct.jsp?prod_id=8005
    The Mac mini does have an IR receiver. This can be used with the EyeTV app, iTunes, and similar. Yes I believe EyeTV would run for prolonged periods quite happily, it is has been around for a long time and had most of the rough edges polished off. However one issue you will have to deal with is that it does not automatically update its program guide data. For this you might have to write or modify an AppleScript. Elgato support or their user forums will be a lot of help.
    You can set EyeTV to convert recordings to an iTunes (Apple TV) compatible format and then delete them from EyeTV.
    The HDMI Detective should solve your handshaking problems.

  • How do you determine remaining capacity on ipod shuffle

    How can you determine remaining capacity on ipod shuffle?

    I tried this and did not see anything in iTunes. I'm not the smartest guy on the block when it deals with computers. Hey i'm 73 years young!! Thanks for your help anyway.

  • How do you reset the dlsmusic device or make it visible in order for other programs such as Sibelius or Finale be able to use it?to be visib

    How do you reset the dlsmusic device or make it visible in order for other programs such as Sibelius or Finale be able to use it?

    I figured out that if you remove the ~/Library/Preferences/com.apple.symbolichotkeys.plist file and restart, that restores the keyboard.
    Second question: Is there any way to make F4 (without holding fn) bring up Dashboard on Lion that doesn't require FunctionFlip? If it matters, I have a Time Machine backup of the symbolichotkeys.plist file from when I had the older keyboard.

Maybe you are looking for

  • Multiple time submission of a form automatically in struts

    I have a button in jsp, when the onclick event is fired, it will send the request to someaction.do to generate a report and display that report in a new window. After clicking the button to generate the report, in the business class a sql query is ge

  • Windows: iphone does not show in itunes

    Hi all, I used to sync my iphone with itunes on my notebook. I realy dont know what changed but: from one day to the other, itunes does not recognize the iphone any more. ( the cable seems to be ok, since when I connect the iphone to a different comp

  • MainStage 2.2.2 released

    MainStage 2.2.2: Release notes Products Affected MainStage 2.2 Symptoms MainStage 2.2.2 is a software update for MainStage 2.2. MainStage 2.2 is a feature upgrade for MainStage 1.0 and 2.0 customers available for purchase on the Mac App Store. MainSt

  • Import movies to iphotos or iMovies?

    I am not a professional videographer.  I am just wondering which place is better to import my videos to---Iphoto or IMovie? And why? I understand there is alot more I can do with the movie if I upload to IMovie but, is there any negative to storing t

  • Zen MicroPhoto not playing tracks in proper ord

    Hey all, Just got this player and it is pretty good. Having one problem though. Some albums do not play songs in the proper order. Instead they are played in alphabetical order. I checked the tag information on the player and it reads the tracks as h