Commit 61027173 authored by Arnaud Blanchard's avatar Arnaud Blanchard

Remove deprecated exemple of t_net_channel

parent 58796a13
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2011 - 2016)
# Author: Arnaud Blanchard
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
project(t_net_channel_client)
add_definitions(-Wall -Wno-multichar)
if (BLAAR_DIR)
add_subdirectory(${BLAAR_DIR}/blc_core blc_core)
add_subdirectory(${BLAAR_DIR}/blc_channel blc_channel)
else()
message("Outside blaar dir not yet managed")
endif()
include_directories(${BL_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} ${BL_LIBRARIES})
#Add a target to generate documentation
#find_package(Doxygen)
#if(DOXYGEN_FOUND)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in doxyfile.doxy) #Replace the CMAKE variables in the Doxyfile
#add_custom_target(doc_${PROJECT_NAME} ALL ${DOXYGEN_EXECUTABLE} doxyfile.doxy COMMENT "Generating API documentation with Doxygen" VERBATIM )
#else(DOXYGEN_FOUND)
#message("You need to install doxygen to generate the doc.")
#endif(DOXYGEN_FOUND)
/* Author: Arnaud Blanchard
Example to demonstrate how to use blc_network.
*/
#include "blc_channel.h"
#include "blc_net_channel.h"
#include "blc_network.h"
#include <sys/time.h>
#define BUFFER_SIZE 1024
int main(int, char **){
blc_channel channel, *titi;
// blc_network network;
blc_net_channel net_channel;
struct timeval timer;
fprintf(stderr, "\nExample of a program sending udp messages on 'localhost', port '3333'\n'q' to quit\n");
// channel.create_or_open("/toto.titi", BLC_CHANNEL_WRITE, 'INT8', 'TEXT', 1, 256);
// net_channel.init("localhost", "3333", BLC_UDP4, BUFFER_SIZE);
titi=net_channel.recv_update("/tata.titi", "localhost");
//channel.fprint_info(stderr);
fprintf(stderr, "\n");
do{
fprintf(stderr, "Text to send ?...\n");
SYSTEM_ERROR_CHECK(fgets(net_channel.chars + sizeof(timer), BUFFER_SIZE -sizeof(timer), stdin), NULL, NULL);
gettimeofday((struct timeval*)net_channel.data, NULL);
// channel.sprint_info(net_channel.chars, net_channel.size);
printf("channel:\n%s\n", titi->chars);
} while(strncmp(net_channel.chars+sizeof(timer), "q\n", 2)!=0);
net_channel.close_and_free_buffer();
return EXIT_SUCCESS;
}
\ No newline at end of file
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2011 - 2016)
# Author: Arnaud Blanchard
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
project(t_net_channel_server)
add_definitions(-Wall -Wno-multichar)
if (BLAAR_DIR)
add_subdirectory(${BLAAR_DIR}/blc_core blc_core)
add_subdirectory(${BLAAR_DIR}/blc_channel blc_channel)
else()
#usually /usr/local/include/blc
find_path(BLC_CORE_INCLUDE_DIRS blc_core.h HINTS blc)
find_path(BLC_CHANNEL_INCLUDE_DIRS blc_channel.h HINTS blc)
list(APPEND BL_INCLUDE_DIRS ${BLC_CORE_INCLUDE_DIRS} ${BLC_CHANNEL_INCLUDE_DIRS})
find_library(BLC_CORE_LIBRARIES blc_core)
find_library(BLC_CHANNEL_LIBRARIES blc_channel)
list(APPEND BL_LIBRARIES ${BLC_CORE_LIBRARIES} ${BLC_CHANNEL_LIBRARIES})
endif()
include_directories(include ${BL_INCLUDE_DIRS})
#Both librairies have the same name only the extension will change depending on the OS
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} ${BL_LIBRARIES} )
#Add a target to generate documentation
#find_package(Doxygen)
#if(DOXYGEN_FOUND)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in doxyfile.doxy) #Replace the CMAKE variables in the Doxyfile
#add_custom_target(doc_${PROJECT_NAME} ALL ${DOXYGEN_EXECUTABLE} doxyfile.doxy COMMENT "Generating API documentation with Doxygen" VERBATIM )
#else(DOXYGEN_FOUND)
#message("You need to install doxygen to generate the doc.")
#endif(DOXYGEN_FOUND)
/* Author: Arnaud Blanchard
Example to demonstrate how to use blc_network.
*/
#include "blc_text.h"
#include "blc_realtime.h"
#include "blc_network.h"
#include "blc_net_channel.h"
#include "blc_channel.h"
#include "unistd.h"
#include <pthread.h>
#include <sys/time.h>
#define BLC_CHANNEL_DEFAULT_PORT "33333"
blc_channel *channels = NULL;
int channels_nb = 0;
blc_net_channel *net_channels = NULL;
int net_channels_nb = 0;
int channel_server_socket = 0;
pthread_t thread;
void *callback_arg;
blc_network network;
static void* server_manager(void *arg){
blc_network *network=(blc_network*)arg;
ssize_t received_data_size;
// struct addrinfo hints, *results;
// struct sockaddr_in target_address;
while(1){
// SYSTEM_ERROR_CHECK(received_data_size = recvmsg(network->socket_fd, &network->msghdr, 0), -1, "Error receiving data.");
// msghdr.msg_name;
}
return NULL;
}
int main(int, char **){
blc_server server;
blc_channel channel;
fprintf(stderr, "\nExample of a program waiting udp channel on port '33333'\n'q' to quit\n");
channel.create_or_open("/tata.titi", BLC_CHANNEL_WRITE, 'INT8', 'UTF8', 1, 45);
strncpy(channel.chars, "Mon text", channel.size);
blc_net_channel_start_server(BLC_CHANNEL_DEFAULT_PORT);
while(getchar()!='q');
server.stop_and_free_buffer();
return EXIT_SUCCESS;
}
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