Commit bda79245 authored by Andreas Schmidt's avatar Andreas Schmidt

PrrtSocket gets address tuple as first parameter.

parent e2fbdea1
......@@ -3,7 +3,7 @@ import prrt
port = int(sys.argv[1])
s = prrt.PrrtSocket(port=port)
s = prrt.PrrtSocket(("127.0.0.1", port))
while True:
d, addr = s.recv()
......
......@@ -5,7 +5,7 @@ host = sys.argv[1]
port = int(sys.argv[2])
localport = int(sys.argv[3])
s = prrt.PrrtSocket(port=localport)
s = prrt.PrrtSocket(("127.0.1.1", localport))
s.connect(host, port)
for i in range(10):
......
......@@ -136,6 +136,8 @@ bool PrrtSocket_bind(PrrtSocket *s, const char *ipAddress, const uint16_t port)
struct sockaddr_in *address = calloc(1, size);
check_mem(address);
// TODO: Allow DNS names to be passed as ipAddress.
address->sin_family = AF_INET;
address->sin_addr.s_addr = inet_addr(ipAddress);
address->sin_port = htons((uint16_t) (port));
......
......@@ -118,13 +118,13 @@ class PrrtCodingConfiguration:
cdef class PrrtSocket:
cdef cprrt.PrrtSocket* _c_socket
def __cinit__(self, port, target_delay = 1, thread_pinning = False):
def __cinit__(self, address, target_delay = 1, thread_pinning = False):
host, port = address
target_delay_us = target_delay * 1000**2
self._c_socket = cprrt.PrrtSocket_create(target_delay_us)
if thread_pinning:
cprrt.PrrtSocket_enable_thread_pinning(self._c_socket)
cprrt.PrrtSocket_bind(self._c_socket, "0.0.0.0", port)
cprrt.PrrtSocket_bind(self._c_socket, host.encode("utf8"), port)
property plr_fwd:
def __get__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment