How to choose which Network interface to use?

前端 未结 2 1621
南方客
南方客 2021-01-12 20:16

I use Qt for my TCP communication. If my PC has 2 network interfaces (say eth0, eth1), and say I want to explicitly use eth1, how do I do that in Qt?

2条回答
  •  时光取名叫无心
    2021-01-12 20:35

    That's not a Qt question, that's a socket question. Bind() to the address on eth1. You have to hope that the routing table will actually do what you expect when you do that.

提交回复
热议问题