lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] connection request dropped in IP layer


From: Luigi
Subject: [lwip-users] connection request dropped in IP layer
Date: Wed, 1 Aug 2007 19:51:52 +0200

Hi,
I'm trying to create a comunication between a client and an echo server;
but there is a behaviour of the server that I don't understand, the packet of the connection request from the client is dropped when is received from the server, it seems that the packet isn't for the server.
That is what I wrote in my programs:
 
/* for the client */
 
...
 
 mem_init();
 memp_init();
 pbuf_init();
 netif_init();
 ip_init();
 tcp_init();
 printf("stack TCP/IP initializzato.\n");
 
 IP4_ADDR(&GateWay, 192,168,0,2);
 IP4_ADDR(&IP, 192,168,0,1);
 IP4_ADDR(&NetMask, 255,255,255,0);
 
 netif_add(&Net, &IP, &NetMask, &GateWay, NULL, clientif_init, ip_input);
 
 netif_set_default(&Net);
 
 cli_init(pcb);
...
 
void cli_init(struct tcp_pcb *pcb)
{
 struct ip_addr IPDest;
 IP4_ADDR(&IPDest, 192, 168, 0, 2);
 
 pcb = tcp_new();
 
 tcp_connect(pcb, &IPDest, 5000, &cli_connected);
}
 
...
 
/* for the server */
 
...
 
 mem_init();
 memp_init();
 pbuf_init();
 netif_init();
 ip_init();
 tcp_init();
 printf("stack TCP/IP initializzato.\n");
 
 IP4_ADDR(&GateWay, 192,168,0,1);
 IP4_ADDR(&IP, 192,168,0,2);
 IP4_ADDR(&NetMask, 255,255,255,0);
 
 netif_add(&Net, &IP, &NetMask, &GateWay, NULL, serverif_init, ip_input);
 
 netif_set_default(&Net);
 
 srv_init();
...
 
void srv_init(void)
{
 struct tcp_pcb *pcb;
 
 pcb = tcp_new();
 tcp_bind(pcb, IP_ADDR_ANY, 5000);
 pcb = tcp_listen(pcb);
 
 tcp_accept(pcb, srv_accept);
}
 
...
 
I don't understand where is the error, there is someone that can help me?
 
thanks.
 
Luigi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]