Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable the IPv6 address? #3457

Open
chance-yang opened this issue Nov 7, 2023 · 1 comment
Open

How to disable the IPv6 address? #3457

chance-yang opened this issue Nov 7, 2023 · 1 comment
Labels
iot Issues with the AWS Android SDK for Internet of Things (IoT) question General question

Comments

@chance-yang
Copy link

chance-yang commented Nov 7, 2023

We have many customers whose networks do not support IPV6. Is there a way to set up the MQTT connection to use only IPV4?

code snippets

// MQTT Client
            if (mqttManager == null) {
                mqttManager = new AWSIotMqttManager(mClientId, mEndPoint);
                // Set keepalive to 10 seconds.  Will recognize disconnects more quickly but will also send
                // MQTT pings every 10 seconds.
                int keepAlive = connectConfig.getKeepAlive();
                mqttManager.setKeepAlive(keepAlive);
                int minReconnectRetryTime = connectConfig.getMinReconnectRetryTime();
                int maxReconnectRetryTime = connectConfig.getMaxReconnectRetryTime();
                if (minReconnectRetryTime <= 0) {
                    minReconnectRetryTime = (int) (keepAlive * 1.5) + 1;
                }
                if (maxReconnectRetryTime <= 0 || minReconnectRetryTime >= maxReconnectRetryTime) {
                    maxReconnectRetryTime = minReconnectRetryTime + 120;
                }
                mqttManager.setReconnectRetryLimits(minReconnectRetryTime,
                        maxReconnectRetryTime);
                mqttManager.setAutoReconnect(true);
                mqttManager.setCleanSession(false);
                mqttManager.setMaxAutoReconnectAttempts(connectConfig.getMaxAutoReconnectAttempts());
            }
            String keyStoreName = Utils.getMd5Value(mClientId + mEndPoint);
            
            KeyStore clientKeyStore = getClientKeyStore(context, keyStoreName, certificatePemId, privatePemId);
            isConnecting = true;
            int portNumber = connectConfig.getPortNumber();
            if (portNumber == 443) {
                mqttManager.connectUsingALPN(clientKeyStore, new MqttClientCallback());
            } else {
                mqttManager.connect(clientKeyStore, new MqttClientCallback());
            }

Environment(please complete the following information):

  • implementation 'com.amazonaws:aws-android-sdk-iot:2.64.0'
  • implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.64.0'
@tylerjroach
Copy link
Contributor

Hi @chance-yang Please see this thread (#2105) to see if any solutions are able to fit your use case.

@tylerjroach tylerjroach added question General question iot Issues with the AWS Android SDK for Internet of Things (IoT) labels Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iot Issues with the AWS Android SDK for Internet of Things (IoT) question General question
Projects
None yet
Development

No branches or pull requests

2 participants