Installing our app interferes with network connection in another app

Apologies if this is not the correct topic to post under.

EpochField 5.2 is our application. It's a .NET MAUI application built against XCode 16. A customer of ours uses another app, TN3270, to connect to a mainframe host. After installing our app on an iPad and restarting the device, the TN3270 app will disconnect when suspended. Uninstalling our app (EpochField) will allow the TN3270 to suspend without disconnecting. We have tried removing background services, setting UIRequiresFullScreen to false or removing it entirely, and several other ideas. The only remedy seems to be uninstalling EpochField.

On an iPad device:

  1. Install MochaSoft’s TN3270 app (free version is fine). Create a connection to ssl3270.nccourts.org, port 2023, SSL/TLS turned on, keep alive turned on.

  2. Verify that you can connect. Suspend the app by swiping up or choosing another app. Go back to TN3270 and verify that the app has not disconnected.

  3. Install EpochField 5.2. Do not run or configure the app, just install it.

  4. Repeat step 2.

  5. Restart the device.

  6. Open EpochField 5.2. You do not need to configure the app or login. Sometimes it isn't necessary to ever open EpochField to get the disconnects, but this is the most reliable way to reproduce the situation.

  7. Repeat step 2. The TN3270 app will now disconnect when suspended, even if EpochField is closed. You may need to wait a few seconds after suspending.

  8. Uninstall EpochField 5.2.

  9. Repeat step 2: the TN3270 app will now remain connected when suspended.

Answered by DTS Engineer in 852133022

The behaviour you’ve described in the failing case (specifically, in step 7) sounds right to me. I’m presuming that the TN3270 app is implementing the Telnet 3270 protocol. That’s based on TCP and, in general, TCP connections ‘tear’ when an app is suspended.

I talk about this more in TN2277 Networking and Multitasking. Note that I’ve not updated that technote in a long time, so some things have drifted:

  • Its terminology is somewhat out of date. Rather than talking about socket resource reclaim, I now say that the connection has been defuncted.
  • Recent versions of iOS defunct on app suspend, so you don’t have to explicitly lock the device.

As to why it’s working when your app isn’t installed, that’s hard to say. It’s possible that the TN3270 app is doing something weird to prevent defuncting, and the presence of your app is causing that to fail. Or it’s possible that there’s some sort of OS issue in play.

It sounds like you’re able to reproduce this yourself. If so, I have an experiment for you to run:

  1. Create a small test app that opens a TCP connection to the target server [1].
  2. Run through your steps to reproduce to see if it behaves the same way as TN3270.

The goal here is to get the TN3270 app out of the picture, giving you control over ‘both sides’ of the problem.

OTOH, if your app behaves correctly (well, according to my definition of correct) then it’s gonna be hard to debug this without talking to the TN3270 app developer.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] You mentioned ssl3270.nccourts.org port 2023. I’m unable to access that at all:

% nc -v ssl3270.nccourts.org 2023 
nc: connectx to ssl3270.nccourts.org port 2023 (tcp) failed: Connection refused

The behaviour you’ve described in the failing case (specifically, in step 7) sounds right to me. I’m presuming that the TN3270 app is implementing the Telnet 3270 protocol. That’s based on TCP and, in general, TCP connections ‘tear’ when an app is suspended.

I talk about this more in TN2277 Networking and Multitasking. Note that I’ve not updated that technote in a long time, so some things have drifted:

  • Its terminology is somewhat out of date. Rather than talking about socket resource reclaim, I now say that the connection has been defuncted.
  • Recent versions of iOS defunct on app suspend, so you don’t have to explicitly lock the device.

As to why it’s working when your app isn’t installed, that’s hard to say. It’s possible that the TN3270 app is doing something weird to prevent defuncting, and the presence of your app is causing that to fail. Or it’s possible that there’s some sort of OS issue in play.

It sounds like you’re able to reproduce this yourself. If so, I have an experiment for you to run:

  1. Create a small test app that opens a TCP connection to the target server [1].
  2. Run through your steps to reproduce to see if it behaves the same way as TN3270.

The goal here is to get the TN3270 app out of the picture, giving you control over ‘both sides’ of the problem.

OTOH, if your app behaves correctly (well, according to my definition of correct) then it’s gonna be hard to debug this without talking to the TN3270 app developer.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] You mentioned ssl3270.nccourts.org port 2023. I’m unable to access that at all:

% nc -v ssl3270.nccourts.org 2023 
nc: connectx to ssl3270.nccourts.org port 2023 (tcp) failed: Connection refused

Thank you for your response!

For connecting to ssl3270.nccourts.org, we turn on the SSL/TLS option in the TN3270 app. I'm not familiar with the CLI options to offer a correction, if one is necessary.

I understand you're saying that TCP connections can "tear" when an app is suspended. The strange thing is that the TN3270 app is otherwise stable until our app is installed. Our customer needs both apps working simultaneously, and it's difficult to tell them "that's just how the protocol works" in this situation. Not saying you're wrong, you obviously know much more about this than we do. Just stating the difficult spot we're in. I'll read your article to learn more!

I will give your idea of a test connection app a try! It might help us see what's happening from the other app's perspective.

Thank you!

Ah, nccourts.org is deliberately locking me out. When I go to www.nccourts.org, the site tells me I’m blocked. This seems to be because I’m not in the US. If I bounce through a Mac in Cupertino [1], I’m able to connect.

I will give your idea of a test connection app a try!

Cool. When you reply here, use @DTS Engineer to tag me in. That’ll increase the chances of me seeing your reply.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@DTS Engineer

Our customer noticed that if they have the iPad in a state where TN3270 is disconnecting when suspended, allowing the device to auto-lock will allow TN3270 to maintain a connection when suspended.

  • Get the device in a state where TN3270 disconnects when suspended.
  • Close the TN3270 app (and any other apps that would prevent auto-lock)
  • Allow the device to auto-lock
  • Unlock the device
  • TN3270 will now maintain a connection even when suspended or used with EpochField.
  • This behavior persists until the device is restarted.

Would you have any idea why auto-locking the device would affect how the kernel decides if a connection gets defuncted? Maybe garbage collection or some other resource optimization routine?

Is there anything we can do in the EpochField app to influence whether the TN3270 TCP connection is maintained? Would we be able to invoke, directly or indirectly, the same routine or process involved with the auto-lock workaround? (I know that's a long shot but I have to ask!)

FYI: I will be out of the office on vacation starting 5PM Mountain on 8/8, returning Monday 8/18. I'll respond to any updates when I'm back. Thanks again!

Installing our app interferes with network connection in another app
 
 
Q