Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PRRT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
37
Issues
37
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LARN
PRRT
Commits
bda79245
Commit
bda79245
authored
Apr 26, 2018
by
Andreas Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PrrtSocket gets address tuple as first parameter.
parent
e2fbdea1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
5 deletions
+7
-5
examples/receiver.py
examples/receiver.py
+1
-1
examples/sender.py
examples/sender.py
+1
-1
prrt/proto/socket.c
prrt/proto/socket.c
+2
-0
prrt/prrt.pyx
prrt/prrt.pyx
+3
-3
No files found.
examples/receiver.py
View file @
bda79245
...
...
@@ -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
()
...
...
examples/sender.py
View file @
bda79245
...
...
@@ -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
):
...
...
prrt/proto/socket.c
View file @
bda79245
...
...
@@ -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
));
...
...
prrt/prrt.pyx
View file @
bda79245
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment