def getPortNumNetworkByteOrder(st_host):
"""
Convert 16-bit positive integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation.
:param st_host:
:return: 80-20480
"""
try:
st_host = int(st_host)
return socket.htons(st_host)
except Exception as e:
logging.error("[HostByteOrderPortFalse]: %f %s" % (st_host, repr(e)))
评论列表
文章目录