Skip to content

Interface (e.g eth0) setting using setsockopt on secure socket prior to connect is failing #2400

@p-neels

Description

@p-neels

Expected behavior

Using a HTTPSClientSession object prior to connect should be able to set socket options to bind it to a specific interface e.g eth0,eth1

Actual behavior

When we directly try to set socket option using m_HTTPSClientSession->socket().setOption() the call throws exception invalid socket.
To avoid invalid socket issue tried to derive HTTPSClientSession so init of socket is accessible and able to use setsockopt on valid socket.
Though this option is set successfully, the actual sokcet used to connect as part of SecureStreamSocketImpl is different (SecureSocketImpl _impl) so it doesn't get connected with provided interface details whihc are set on different socket.

Steps to reproduce the problem

(please make this a SSCCE, if applicable and reasonable)

POCO version

1.9.0

Compiler and version

Operating system and version

Other relevant information

Went through the below pullrequest changes which is available on latest develop which supports bind to srcAddress prior to connect.
https://github.com/pocoproject/poco/pull/2078/files
But in some cases if routing is through default at network layer bind does not help.
Need to set interface specifically.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions