Minor changes

This commit is contained in:
Loic Guegan 2023-07-15 16:06:43 +02:00
parent b8bdb006a3
commit 97c48bd23d
3 changed files with 7 additions and 4 deletions

View file

@ -1,6 +1,6 @@
##### ZeroMQ
PUBLISHER_PORT=5556
PUBLISHER_ADDR=localhost
PUBLISHER_INTERFACE=*
##### Logger/Publisher
# LOGGERS_DIR will contains all the data generated by the loggers

View file

@ -58,6 +58,7 @@ int main (int argc, char *argv [])
interval=atoi(token);
if(line==4){
printf("Data received with key=%s\n",key);
char path[255]="";
sprintf(path,"%s/%s_%s_%ld",cdatadir,key,client,interval);
fptr=fopen(path,"a");

View file

@ -12,6 +12,7 @@
// Global:
char *__logdir;
char *__key;
char *__interface;
int __loginterval;
int __port;
@ -19,8 +20,8 @@ void publish(void *publisher, char *filepath, char* client, long int interval);
int main (int argc, char *argv [])
{
if(argc != 5){
printf("Usage: %s <abslogdir> <loginterval> <port> <key>",argv[0]);
if(argc != 6){
printf("Usage: %s <abslogdir> <loginterval> <port> <key> <interface>",argv[0]);
exit(1);
}
@ -29,12 +30,13 @@ int main (int argc, char *argv [])
__loginterval=atoi(argv[2]);
__port=atoi(argv[3]);
__key=argv[4];
__interface=argv[5];
//----- Prepare our context and publisher
void *context = zmq_ctx_new ();
void *publisher = zmq_socket (context, ZMQ_PUB);
char bindto[30];
sprintf(bindto,"tcp://*:%d",__port);
sprintf(bindto,"tcp://%s:%d",__interface,__port);
int rc = zmq_bind (publisher, bindto);
if(rc!=0){
printf("Failed to bind zmq on %s\n",bindto);