[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out
From: |
Justin Bayles |
Subject: |
Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out |
Date: |
Fri, 18 Jun 2004 10:38:33 +1000 |
/*
* Write process
*/
/* Add a network interface */
IP4_ADDR(&ipaddr, 192,168,0,2);
IP4_ADDR(&netmask, 255,255,255,0);
IP4_ADDR(&gw, 192,168,0,1);
if (!netif_add(&nif, &ipaddr, &netmask, &gw, &state, slipif_init, ip_input))
return;
/* Setup a new TCP connection */
if ((conn = netconn_new(NETCONN_TCP)) == NULL) return;
if ((err = netconn_bind(conn, &ipaddr, 80)) != ERR_OK) return;
/* Connect to the remote IP*/
IP4_ADDR(&ipaddrremote, 192,168,0,3);
if ((err = netconn_connect(conn, &ipaddrremote, 80)) != ERR_OK) return;
while (1)
{
printf("send packet %d\n", packetNumber);
sprintf(data, "Hello World %d", packetNumber++);
ret = netconn_write(conn, data, strlen(data), NETCONN_COPY);
/* wWaitForSingleObject is a wrapper around WaitForSingleObject because
* I cannont include the lwip header files clash with windows.h
*/
wWaitForSingleObject(wait, 100);
}
/*
* Read process
*/
/* Add a network interface */
IP4_ADDR(&ipaddr, 192,168,0,3);
IP4_ADDR(&netmask, 255,255,255,0);
IP4_ADDR(&gw, 192,168,0,1);
if (!netif_add(&nif, &ipaddr, &netmask, &gw, &state, slipif_init, ip_input))
return;
/* Make a netbuf to store data to be sent */
buf = netbuf_new();
/* Setup a new TCP connection */
if ((conn = netconn_new(NETCONN_TCP)) == NULL) return;
/* Bind the connection to our IP address */
if ((err = netconn_bind(conn, NULL, 80)) != ERR_OK)return;
/* Tell the connection to listen for incoming connection requests. */
if ((err = netconn_listen(conn)) != ERR_OK)return;
/* block until we get an incoming connnection */
if ((newConn = netconn_accept(conn)) == NULL) return;
while(1)
{
buf = netconn_recv(newConn);
printf("new packet arrived\n");
do
{
netbuf_data(buf, &data, &len);
printf("length = %d\n", len);
fwrite(data, len, sizeof(char), stdout);
printf("\n");
nbn = netbuf_next(buf);
//printf("nbn = %d\n", nbn);
} while (nbn >= 0);
netbuf_delete(buf);
}
From: "K.J. Mansley" <address@hidden>
Reply-To: Mailing list for lwIP users <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Subject: Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out
Date: 17 Jun 2004 18:11:15 +0100
On Thu, 2004-06-17 at 17:50, Leon Woestenberg wrote:
> Hello Justin,
>
> Justin Bayles wrote:
>
> >> I am not into the netconn_ layer, but shouldn't the sysarch
semaphores
> >> already synchronize access to the TCP layer? I.e. are you really
seeing
> >> concurrent access to both tcp_in and tcp_enqueue?
> >
> > There is no synchronisation in either tcp_in or tcp_out. I am
definitely
> > seeing concurrent access to tcp_in and tcp_out.
> >
> Yes, the lwIP core does no synchronization whatsoever (by design). The
> higher layer should handle this.
>
> lwIP core = {tcp, udp, icmp, arp, ip}
>
> You said you where not using tcp_*() directly. What is your way of
> sending and receive from TCP? netconn_*()? I.e. what is your higher
> layer around the lwIP core?
And, if you are using the netconn_*() API, how are you injecting packets
received from the network into the stack? Are you calling tcpip_input()
(which performs the synchronization), or bypassing that and going
straight to ip_input()?
Kieran
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
_________________________________________________________________
Smart Saving with ING Direct earn 5.25% p.a. variable rate:
http://ad.au.doubleclick.net/clk;7249209;8842331;n?http://www.ingdirect.com.au/burst6offer.asp?id=8
- [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/09
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/10
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/15
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/16
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/16
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out,
Justin Bayles <=
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/17
- [lwip-users] Router issues with lwip, Martin Glunz, 2004/06/20
- Re: [lwip-users] Router issues with lwip, K.J. Mansley, 2004/06/21
- Re: [lwip-users] Router issues with lwip, Martin Glunz, 2004/06/22
- Re: [lwip-users] Router issues with lwip, K.J. Mansley, 2004/06/23
- Re: [lwip-users] Router issues with lwip, Leon Woestenberg, 2004/06/23
- Re: [lwip-users] Router issues with lwip, Martin Glunz, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Leon Woestenberg, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Martin . Glunz, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Leon Woestenberg, 2004/06/24