2020-04-05 06:30 PM
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");
}
}
}