示例#1
0
def _getservicename(sin_port, flags):
    if flags & NI_NUMERICSERV:
        sp = lltype.nullptr(_c.cConfig.servent)
    elif flags & NI_DGRAM:
        sp = _c.getservbyport(sin_port, "udp")
    else:
        sp = _c.getservbyport(sin_port, "tcp")

    if sp:
        serv = rffi.charp2str(sp.c_s_name)
    else:
        serv = "%d" % r_uint(_c.ntohs(sin_port))

    return serv
示例#2
0
def _getservicename(sin_port, flags):
    if flags & NI_NUMERICSERV:
        sp = lltype.nullptr(_c.cConfig.servent)
    elif flags & NI_DGRAM:
        sp = _c.getservbyport(sin_port, "udp")
    else:
        sp = _c.getservbyport(sin_port, "tcp")

    if sp:
        serv = rffi.charp2str(sp.c_s_name)
    else:
        serv = "%d" % r_uint(_c.ntohs(sin_port))

    return serv
示例#3
0
文件: rsocket.py 项目: alkorzt/pypy
def ntohs(x):
    return rffi.cast(lltype.Signed, _c.ntohs(x))
示例#4
0
def ntohs(x):
    return rffi.cast(lltype.Signed, _c.ntohs(x))