Commit 56d1f9b6 authored by Andreas Schmidt's avatar Andreas Schmidt

Update Cython bindings.

parent fd5b00ca
Pipeline #57 passed with stage
......@@ -7,7 +7,7 @@ import threading
class receiverThread(threading.Thread):
def __init__(self, seqnoDigits):
threading.Thread.__init__(self)
self.sock = prrt.PrrtSocket(5000, False)
self.sock = prrt.PrrtSocket(7000, False)
self.stats = {}
self.received = set()
......@@ -29,12 +29,12 @@ class receiverThread(threading.Thread):
class senderThread(threading.Thread):
def __init__(self, seqnoDigits, packetCount):
threading.Thread.__init__(self)
self.sock = prrt.PrrtSocket(6000, True)
self.sock = prrt.PrrtSocket(7005, True)
self.packetCount = packetCount
self.seqnoDigits = seqnoDigits
def run(self):
self.sock.connect("127.0.0.1", 5000)
self.sock.connect("127.0.0.1", 7000)
for i in range(self.packetCount):
self.sock.send(str(i).zfill(self.seqnoDigits))
time.sleep(0.001)
......@@ -44,7 +44,7 @@ class senderThread(threading.Thread):
if __name__ == "__main__":
# Works: 2^15; Segfault at: 2^16
packetCount = 2**16
seqnoDigits = 10
seqnoDigits = 15
recvThread = receiverThread(seqnoDigits)
recvThread.daemon = True
sendThread = senderThread(seqnoDigits, packetCount)
......
......@@ -79,6 +79,10 @@ cdef extern from "prrt/receiver.h":
const char* host_name
uint16_t port
PrrtReceiver* PrrtReceiver_create(const char *host, uint16_t port)
bint PrrtReceiver_destroy(PrrtReceiver* receiver)
cdef extern from "prrt/socket.h":
cdef struct prrtSocket:
int dataSocketFd
......
......@@ -26,6 +26,10 @@ cdef extern from "prrt/vdmcode/block_code.c":
cdef extern from "prrt/coding_params.c":
void PrrtCodingParams_init(cprrt.PrrtCodingParams *cpar)
cdef extern from "prrt/receiver.c":
cprrt.PrrtReceiver* PrrtReceiver_create(const char *host, uint16_t port)
bint PrrtReceiver_destroy(cprrt.PrrtReceiver* receiver)
cdef extern from "prrt/packet.c":
uint8_t PrrtPacket_type(cprrt.PrrtPacket *packet_ptr)
uint8_t PrrtPacket_priority(cprrt.PrrtPacket *packet_ptr)
......
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