Loading prrt/proto/socket.c +6 −0 Original line number Diff line number Diff line Loading @@ -223,6 +223,12 @@ int PrrtSocket_send(PrrtSocket *s, const uint8_t *data, const size_t data_len) { PERROR("Data to be sent (%ld bytes) is too long, as MTU is %d.\n", data_len, s->maximum_payload_size); return -1; } if(s->receiver == NULL) { PERROR("PrrtSocket_connect() must be called before PrrtSocket_send().\n"); return -1; } XlapTimestampPlaceholder tsph; XlapTimestampPlaceholderInitialize(&tsph); XlapTimeStampClock(&tsph, ts_any_packet, 0, PrrtSendStart); Loading prrt/prrt.pyx +5 −1 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ class PrrtCodingConfiguration: cdef class PrrtSocket: cdef cprrt.PrrtSocket* _c_socket _epoch = datetime.datetime.utcfromtimestamp(0) _connected = False def __cinit__(self, address, maximum_payload_size = 1400, target_delay = 1, thread_pinning = False): host, port = address Loading Loading @@ -202,11 +203,14 @@ cdef class PrrtSocket: host, port = address cdef bytes encodedHost = host.encode("utf-8") cprrt.PrrtSocket_connect(self._c_socket, encodedHost, port) self._connected = True def send(self, data): if not self._connected: raise Exception("PrrtSocket must be connected first, before data can be sent.") maximum_payload_size = cprrt.PrrtSocket_get_sock_opt(self._c_socket, "maximum_payload_size") data_len = len(data) if len(data) < maximum_payload_size: if len(data) <= maximum_payload_size: cprrt.PrrtSocket_send(self._c_socket, data, data_len) else: raise PayloadTooBigException("Sending packet of {} bytes on a socket with maximum payload size of {} bytes failed.".format(data_len, maximum_payload_size)) Loading Loading
prrt/proto/socket.c +6 −0 Original line number Diff line number Diff line Loading @@ -223,6 +223,12 @@ int PrrtSocket_send(PrrtSocket *s, const uint8_t *data, const size_t data_len) { PERROR("Data to be sent (%ld bytes) is too long, as MTU is %d.\n", data_len, s->maximum_payload_size); return -1; } if(s->receiver == NULL) { PERROR("PrrtSocket_connect() must be called before PrrtSocket_send().\n"); return -1; } XlapTimestampPlaceholder tsph; XlapTimestampPlaceholderInitialize(&tsph); XlapTimeStampClock(&tsph, ts_any_packet, 0, PrrtSendStart); Loading
prrt/prrt.pyx +5 −1 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ class PrrtCodingConfiguration: cdef class PrrtSocket: cdef cprrt.PrrtSocket* _c_socket _epoch = datetime.datetime.utcfromtimestamp(0) _connected = False def __cinit__(self, address, maximum_payload_size = 1400, target_delay = 1, thread_pinning = False): host, port = address Loading Loading @@ -202,11 +203,14 @@ cdef class PrrtSocket: host, port = address cdef bytes encodedHost = host.encode("utf-8") cprrt.PrrtSocket_connect(self._c_socket, encodedHost, port) self._connected = True def send(self, data): if not self._connected: raise Exception("PrrtSocket must be connected first, before data can be sent.") maximum_payload_size = cprrt.PrrtSocket_get_sock_opt(self._c_socket, "maximum_payload_size") data_len = len(data) if len(data) < maximum_payload_size: if len(data) <= maximum_payload_size: cprrt.PrrtSocket_send(self._c_socket, data, data_len) else: raise PayloadTooBigException("Sending packet of {} bytes on a socket with maximum payload size of {} bytes failed.".format(data_len, maximum_payload_size)) Loading