WiFi Logger component  1.0
WiFi Logger component, uses wifi to output logs
tcp_handler.h
Go to the documentation of this file.
1 #ifndef TCP_HANDLER_H
2 #define TCP_HANDLER_H
3 
4 #include <string.h>
5 #include <sys/param.h>
6 #include "freertos/FreeRTOS.h"
7 #include "freertos/task.h"
8 #include "freertos/event_groups.h"
9 #include "esp_system.h"
10 #include "esp_wifi.h"
11 #include "esp_event.h"
12 #include "esp_log.h"
13 #include "nvs_flash.h"
14 #include "esp_netif.h"
15 #include "protocol_examples_common.h"
16 #include "lwip/err.h"
17 #include "lwip/sockets.h"
18 #include "lwip/sys.h"
19 #include <lwip/netdb.h>
20 
21 #define TCP_HOST_IP_ADDR CONFIG_SERVER_IP_ADDRESS
22 #define TCP_PORT CONFIG_SERVER_PORT
23 
25 {
26  char rx_buffer[128];
27  char addr_str[128];
30  struct sockaddr_in dest_addr;
31  int sock;
32 };
33 
34 void tcp_network_manager(struct tcp_network_data* nm);
35 int tcp_send_data(struct tcp_network_data* nm, char* payload);
36 char* tcp_receive_data(struct tcp_network_data* nm);
38 
39 #endif
char * tcp_receive_data(struct tcp_network_data *nm)
Receives data from TCP server.
Definition: tcp_handler.c:77
int sock
Definition: tcp_handler.h:31
char addr_str[128]
Definition: tcp_handler.h:27
char rx_buffer[128]
Definition: tcp_handler.h:26
void tcp_network_manager(struct tcp_network_data *nm)
Manages TCP connection to the server.
Definition: tcp_handler.c:11
void tcp_close_network_manager(struct tcp_network_data *nm)
Shutdown active connection, deallocate memory.
Definition: tcp_handler.c:109
int addr_family
Definition: tcp_handler.h:28
int ip_protocol
Definition: tcp_handler.h:29
struct sockaddr_in dest_addr
Definition: tcp_handler.h:30
int tcp_send_data(struct tcp_network_data *nm, char *payload)
Sends data to the server through a TCP socket.
Definition: tcp_handler.c:49
Definition: tcp_handler.h:24