Opened 10 years ago

Last modified 10 years ago

#2875 assigned Feature Requests

Windows: ip::tcp::acceptor::local_endpoint() cannot be used in socket connect

Reported by: Benjamin Carlyle <ben.carlyle@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.38.0 Severity: Problem
Keywords: Cc:

Description

On linux the local_endpoint() function returns an endpoint similar to 0.0.0.0:1234. A socket which is given this endpoint to connect to will connect successfully. A similar endpoint is returned on Windows, however the socket connection is not successful.

I am currently working around this problem by inserting loopback as the address to connect to. For the sake of consistency between platforms it may be worthwhile including a similar substitution within the socket's connect operation if 0.0.0.0 is detected.

Change History (1)

comment:1 Changed 10 years ago by chris_kohlhoff

Milestone: Boost 1.39.0To Be Determined
Status: newassigned
Type: BugsFeature Requests

Actually the POSIX behaviour when using INADDR_ANY in a connect() operation is to connect to a server listening on any local interface. Mimicking this behaviour for consistency may be possible but is non-trivial. I am going to change this to a feature request to be considered in the future.

Note: See TracTickets for help on using tickets.