Open schien opened 10 years ago
Yes, it is not possible to confirm that a remote address is reachable until packets are received from it. However, I envision cases when it is possible to see, already when checking the routing table, that the requested remote address is not reachable as there is no interface in the routing table providing access to this remote address.
Default route will take care of this case if there is no specific rule for the requested remote address, right? This means we can only foresee a route failure when this host doesn't have a default gateway, which is a strange configuration to me. May I know what's the scenario we expect API user's can gain benefit from this error handling?
The wording in the specification is much based on the discussion in https://github.com/sysapps/tcp-udp-sockets/issues/36. Please have a look.
However, I don't have a strong opinion and can remove the statement about this error handling. It may try to cover a scenario that never can happen.
In UDPSocket constructor clause 4 spec says an error should be thrown if the remote address is unreachable by any local interface (or designated local interface if
localAddress
is provided). However, the routing table can only provide the information of the best local interface to go. As I know it's not possible to determine if an remote address is reachable until you receive a packet from it.