not every socket type is supported by every protocol family for exampleif you're using af_packet to sniff ethernet packets on linuxyou can' establish streamoriented connection using sock_stream insteadyou have to use sock_dgram or sock_raw for af_netlink socketssock_raw is the only supported type addressing in order to perform any communication on socketyou have to specify destination address the form of the address depends on the address family of the socket af_inet (ipv for internet applications using ipv addresses are specified as tuple (hostporthere are two examples('www python org' ( ' if host is the empty stringit has the same meaning as inaddr_anywhich means any address this is typically used by servers when creating sockets that any client can connect to if host is set to ''it has the same meaning as the inaddr_broadcast constant in the socket api be aware that when host names such as 'www python orgare usedpython uses dns to resolve the host name into an ip address depending on how dns has been configuredyou may get different ip address each time use raw ip address such as to avoid this behaviorif needed af_inet (ipv for ipv addresses are specified as -tuple (hostportflowinfoscopeidwith ipv the host and port components work in the same way as ipv except that the numerical form of an ipv host address is typically specified by string of eight colon-separated hexadecimal numberssuch as 'fedc:ba : : :fedc:ba : : or ' :: : (in this casethe double colon fills in range of address components with sthe flowinfo parameter is -bit number consisting of -bit flow label (the low bits) -bit priority (the next bits)and four reserved bits (the high bitsa flow label is typically only used when sender wants to enable special handling by routers otherwiseflowinfo is set to the scopeid parameter is -bit number that' only needed when working with link-local and site-local addresses link-local address always starts with the prefix 'fe and is used between machines on the same lan (routers will not forward link-local packetsin this casescopeid an interface index that identifies specific network interface on the host this information can be viewed using command such as 'ifconfigon unix or 'ipv ifon windows site-local address always starts with the prefix 'fec and is used between machines within the same site (for exampleall machines on given subnetin this casescopeid is site-identifier number if no data is given for flowinfo or scopeidan ipv address can be given as the tuple (hostport)as with ipv lib fl ff