0

here explain why need client socket bind, https://stackoverflow.com/questions/4118241/what-client-side-situations-need-bind

my question is: if I bind a specific source ip before connect, does this connection need an item in route table?

After tested , I found the connect will fail if I delete the related route item.

Why it need a routing table even if I choose to go out from the specific ip(via bind this ip)?

by the way ,the below question is not help Does routing affect a socket with a bound source address?

import socket 

s = socket.socket() 
port = 12345
s.bind(("158.200.201.12",33123))
s.connect(("158.101.170.92", port)) #<--- this will fail if I delete the route table item for 158.*

This question has no relation with language, I just use python to explain

xiaoming
  • 1,069
  • 8
  • 10

0 Answers0