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 switch to another network card when the current network card can not connect to the broker with paho mqtt library #1469

Open
okyihu opened this issue Apr 13, 2024 Discussed in #1468 · 3 comments
Labels

Comments

@okyihu
Copy link

okyihu commented Apr 13, 2024

Discussed in #1468

Originally posted by okyihu April 13, 2024
there are 4 network ports on my circuit board (running the embedded linux system), how to switch to another network card when the current network cann't connect to the broker with paho mqtt API ? thanks for helping.

@icraggs
Copy link
Contributor

icraggs commented Apr 18, 2024

The 1.4 branch has an update to allow this. You can take a look at the paho_c_sub and paho_c_pub samples to see how this works.

@icraggs
Copy link
Contributor

icraggs commented Apr 18, 2024

The 1.4 branch has an update to allow this. You can take a look at the paho_c_sub and paho_c_pub samples to see how this works.

If you invoke paho_c_pub (on the 1.4 branch) like this:

 paho_c_pub x -A sds -v

it will display a list of interfaces and addresses:

Interface name "lo0" family 0 addresses: 
	IPv4 127.0.0.1
	IPv6 ::1
	IPv6 fe80::1

Interface name "en0" family 0 addresses: 
	IPv6 fe80::81:8c3c:5d27:34f7
	IPv6 2002:3394:b915:0:4e8:d264:2b4f:fb10
	IPv6 2002:3394:b915:0:297b:2435:7003:4898
	IPv4 192.168.178.20

Interface name "awdl0" family 0 addresses: 
	IPv6 fe80::84a:6ff:fe18:e6d3

Interface name "llw0" family 0 addresses: 
	IPv6 fe80::84a:6ff:fe18:e6d3

Interface name "utun0" family 0 addresses: 
	IPv6 fe80::94cd:2fe6:5b7c:db09

Interface name "utun1" family 0 addresses: 
	IPv6 fe80::f0e8:9e61:7169:fa82

Interface name "utun2" family 0 addresses: 
	IPv6 fe80::ce81:b1c:bd2c:69e

You can use the interface name or an address to select the interface to use.

@okyihu
Copy link
Author

okyihu commented Apr 20, 2024

The 1.4 branch has an update to allow this. You can take a look at the paho_c_sub and paho_c_pub samples to see how this works.

If you invoke paho_c_pub (on the 1.4 branch) like this:

 paho_c_pub x -A sds -v

it will display a list of interfaces and addresses:

Interface name "lo0" family 0 addresses: 
	IPv4 127.0.0.1
	IPv6 ::1
	IPv6 fe80::1

Interface name "en0" family 0 addresses: 
	IPv6 fe80::81:8c3c:5d27:34f7
	IPv6 2002:3394:b915:0:4e8:d264:2b4f:fb10
	IPv6 2002:3394:b915:0:297b:2435:7003:4898
	IPv4 192.168.178.20

Interface name "awdl0" family 0 addresses: 
	IPv6 fe80::84a:6ff:fe18:e6d3

Interface name "llw0" family 0 addresses: 
	IPv6 fe80::84a:6ff:fe18:e6d3

Interface name "utun0" family 0 addresses: 
	IPv6 fe80::94cd:2fe6:5b7c:db09

Interface name "utun1" family 0 addresses: 
	IPv6 fe80::f0e8:9e61:7169:fa82

Interface name "utun2" family 0 addresses: 
	IPv6 fe80::ce81:b1c:bd2c:69e

You can use the interface name or an address to select the interface to use.

thank you very much. I'll try it later and give you feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants