8
I formerly used the code below to bind IPv4 address to Python socket as source ip address.
import socket
true_socket = socket.socket
def bound_socket(*a, **k):
sock = true_socket(*a, **k)
sock.bind((sourceIP, 0))
return sock
socket.socket = bound_socket
Does above code work for IPv6 address? If not, how can I bind an IPv6 address?
Thanks in advance!