Пример #1
0
def tcpBind(stream, address, port):
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpBind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Пример #2
0
def tcpConnect(stream, address, port, callback):
    connect = alloc_connect()
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpConnect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Пример #3
0
Файл: ruv.py Проект: dckc/typhon
def tcpBind(stream, address, port):
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpBind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Пример #4
0
Файл: ruv.py Проект: dckc/typhon
def tcpConnect(stream, address, port, callback):
    connect = alloc_connect()
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpConnect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Пример #5
0
def tcp6Connect(stream, address, port, callback):
    inet, sin, s_addr, s_fam, s_port = af6

    connect = alloc_connect()
    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Connect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Пример #6
0
def tcp6Bind(stream, address, port):
    inet, sin, s_addr, s_fam, s_port = af6

    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Bind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Пример #7
0
def tcp6Connect(stream, address, port, callback):
    inet, sin, s_addr, s_fam, s_port = af6

    connect = alloc_connect()
    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Connect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Пример #8
0
def tcp6Bind(stream, address, port):
    inet, sin, s_addr, s_fam, s_port = af6

    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Bind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Пример #9
0
def htons(x):
    assert isinstance(x, int)
    return rffi.cast(lltype.Signed, _c.htons(x))
Пример #10
0
def htons(x):
    return rffi.cast(lltype.Signed, _c.htons(x))
Пример #11
0
def htons(x):
    assert isinstance(x, int)
    return rffi.cast(lltype.Signed, _c.htons(x))