My server and client implementations are briefly listed as below:
void server(void *arg){
conn = netconn_new(ctxt, NETCONN_TCP);
netconn_bind(ctxt, conn, NULL, 7);
netconn_listen(ctxt, conn);
while (1) {
/* Grab new connection. */
err = netconn_accept(ctxt, conn, &newconn);
/* Process the new connection. */
if (err == ERR_OK) {
}
/* Close connection and discard connection identifier. */
netconn_close(ctxt, newconn);
netconn_delete(ctxt, newconn);
}
}
void client(void *ctxt)
{
conn = netconn_new(ctxt, NETCONN_TCP);
netconn_bind(ctxt, conn, &((ctxt)->ipaddr), 7 );
err = netconn_connect(ctxt, conn, &((ctxt)->ipaddr_dest), 7);
while (1) {
err = netconn_write_partly(ctxt, conn, buf, buf_size, NETCONN_COPY, bytes_written);
if (err == ERR_OK)
{
netconn_close(ctxt, conn);
netconn_delete(ctxt, conn);
break;
}
}
}
Any suggestions will be helpful, thanks