cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use LWIP to build again and again?

YiKai
Associate II

I build the server to connected. but if i want change the port and built it again, it can't to use

have any advise?

void tcp_server_init(void)
{
 
    tpcb = tcp_new();
 
    if (tpcb != NULL)
    {
        err_t err;
 
        if((Server_port>=9999)||(Server_port<=2)){
        	err = tcp_bind(tpcb, IP_ADDR_ANY, TCP_LOCAL_PORT);
        }
        else{
        	err = tcp_bind(tpcb, IP_ADDR_ANY, Server_port);
        }
 
        if (err == ERR_OK)
        {
            tpcb = tcp_listen(tpcb);
            tcp_accept(tpcb, tcp_server_accept);
        }
        else
        {
            printf("can not bind pcb\r\n");
        }
 
    }
}

0 REPLIES 0