static void tcpecho_thread(void *arg) { struct netconn *conn; err_t err; LWIP_UNUSED_ARG(arg); ip_addr_t IpAdd; ip_addr_t IpAddLoc; struct netbuf* txBuffer; /* Create a new connection identifier. */ conn = netconn_new(NETCONN_TCP); while (netif_list->ip_addr.addr == 0) {}; IP4_ADDR(&IpAdd, 192, 168, 0, 1); IpAddLoc.addr = netif_list->ip_addr.addr; while (1) { /* Tell connection to go into listening mode. */ err = netconn_connect(conn,&IpAdd,8080); // check error for debug if (err != ERR_OK) { // Error __NOP(); } txBuffer = netbuf_new(); netbuf_alloc(txBuffer, 23); // 4 bytes of buffer txBuffer->p->payload = "\fMaster Connected!!\n\n"; txBuffer->p->len = 23; netconn_write(conn, txBuffer->p->payload, 23, NETCONN_COPY); vTaskDelay(100); // To see the result easily in Comm Operator netbuf_delete(txBuffer); netconn_close(conn); vTaskDelay(20000); //wait 20s } } |