From b08bac7a670141982f098afa790641c7b143e8bc Mon Sep 17 00:00:00 2001 From: Arnaud Blanchard <arnaud.blanchard@ensea.fr> Date: Tue, 8 Dec 2020 13:08:26 +0100 Subject: [PATCH] fix send_data and return int --- include/blc_array_network.h | 4 ++-- include/blc_array_tcp4_client.h | 2 +- src/network/blc_array_tcp4_client.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/blc_array_network.h b/include/blc_array_network.h index 4bada89..9a15d8c 100644 --- a/include/blc_array_network.h +++ b/include/blc_array_network.h @@ -15,8 +15,8 @@ typedef struct blc_array_network :blc_array{ ~blc_array_network(); - int recv_data(); - int send_data(); + virtual int recv_data()=0; + virtual int send_data()=0; #else blc_array array; #endif diff --git a/include/blc_array_tcp4_client.h b/include/blc_array_tcp4_client.h index 15592d5..d8b343f 100644 --- a/include/blc_array_tcp4_client.h +++ b/include/blc_array_tcp4_client.h @@ -18,7 +18,7 @@ typedef struct blc_array_tcp4_client // void server_manager(); int recv_data(); int bytes_to_read(); - void send_data(); + int send_data(); #else { blc_array array;// Not beautiful but makes it easy to convert C++ heritage of "class" in C struct inclusion. #endif diff --git a/src/network/blc_array_tcp4_client.cpp b/src/network/blc_array_tcp4_client.cpp index c801ad2..f305c8c 100644 --- a/src/network/blc_array_tcp4_client.cpp +++ b/src/network/blc_array_tcp4_client.cpp @@ -64,8 +64,9 @@ int blc_array_tcp4_client::bytes_to_read(){ return bytes_nb; } -void blc_array_tcp4_client::send_data(){ +int blc_array_tcp4_client::send_data(){ SYSTEM_ERROR_CHECK(write(socket_fd, data, size), -1, nullptr); + return 0; // no error } -- GitLab