File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
testing_posix_tcp_ip_channel_server
testing_tcp_ip_channel_server_callback Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,18 @@ DEVELHELP ?= 1
12
12
# Change this to 0 show compiler invocation lines by default:
13
13
QUIET ?= 1
14
14
15
+ # Enable networking
16
+ USEMODULE += netdev_default
17
+ USEMODULE += auto_init_gnrc_netif
18
+
19
+ # Enable sockets
20
+ USEMODULE += gnrc_ipv6_default
21
+ USEMODULE += sock_tcp
22
+ USEMODULE += posix_sockets
23
+ USEMODULE += posix_sleep
24
+ USEMODULE += posix_inet
25
+
26
+ # Enable posix threads
27
+ USEMODULE += pthread
28
+
15
29
include $(CURDIR ) /../../../make/riot/riot.mk
Original file line number Diff line number Diff line change 2
2
#include "reactor-uc/reactor-uc.h"
3
3
#include <sys/socket.h>
4
4
#include <unistd.h>
5
+ #include <inttypes.h>
5
6
6
7
#define NUM_ITER 10
7
8
@@ -26,7 +27,7 @@ int main(void) {
26
27
for (int i = 0 ; i < NUM_ITER ; i ++ ) {
27
28
// waiting for messages from client
28
29
TaggedMessage * message = channel .super .receive (& channel .super );
29
- printf ("Received message with connection number %i and content %s\n" , message -> conn_id ,
30
+ printf ("Received message with connection number %" PRIi32 " and content %s\n" , message -> conn_id ,
30
31
(char * )message -> payload .bytes );
31
32
32
33
channel .super .send (& channel .super , message );
Original file line number Diff line number Diff line change 1
1
#include "reactor-uc/federated.h"
2
2
#include "reactor-uc/platform/posix/tcp_ip_channel.h"
3
3
#include "reactor-uc/reactor-uc.h"
4
+ #include <inttypes.h>
4
5
#include <sys/socket.h>
5
6
#include <unistd.h>
7
+
6
8
TcpIpChannel channel ;
7
9
8
10
void callback_handler (FederatedConnectionBundle * self , TaggedMessage * msg ) {
9
11
(void )self ;
10
- printf ("Received message with connection number %i and content %s\n" , msg -> conn_id , (char * )msg -> payload .bytes );
12
+ printf ("Received message with connection number %" PRIi32 " and content %s\n" , msg -> conn_id ,
13
+ (char * )msg -> payload .bytes );
11
14
channel .super .send (& channel .super , msg );
12
15
}
13
16
You can’t perform that action at this time.
0 commit comments