def create_tcp_socket(module):
 type_ = module.SOCK_STREAM
 if hasattr(module, 'SOCK_CLOEXEC'):
  type_ |= module.SOCK_CLOEXEC
 sock = module.socket(module.AF_INET, type_)
 _set_default_tcpsock_options(module, sock)
 return sock

def create_tcp_socket ( module ) : type_ = module . SOCK_STREAM if hasattr ( module , 'SOCK_CLOEXEC' ) : type_ |= module . SOCK_CLOEXEC sock = module . socket ( module . AF_INET , type_ ) _set_default_tcpsock_options ( module , sock ) return sock
create a tcp socket with the cloexec flag set .