[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Asynchronous events.
From: |
Nick Thomas |
Subject: |
RE: [lwip-users] Asynchronous events. |
Date: |
Mon, 15 Sep 2008 16:07:42 +0100 |
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf
> Of address@hidden
> Sent: 12 September 2008 17:40
> To: Mailing list for lwIP users
> Subject: Re: [lwip-users] Asynchronous events.
>
>
> You didn't say on which platform your lwIP code runs, but if it is the
> win32, why not try one of the socket examples like the ping example app?
>
Hi, thanks for the reply. I am using an ST chip, running OS20 operating
system.
I have made some progress today. I used wireshark, and enabled all of the
LWIP_DEBUGF stuff to give more info.
The main problem I had was that the I needed to add the 'Host:' to my HTTP
1.1 GET request. The Apache server was getting my request and not responding
with what I expected.
So, now I can send a GET request through LWIP, using the netconn_X and
netbuf_X commands.
The problem I have now is that I can't do it twice!
On the second attempt I now get:
Assertion "tcp_input: pcb->next != pcb (before cache)" failed at line 181 in
\blah\blah\core\tcp_in.c
My code now looks like:
NOTE: test_conn is a 'static struct netconn *test_conn;' which is
netconn_new() at startup.
#define OUR_SERVER "192.168.0.100"
const static char my_hdr[] = "GET / HTTP/1.1\r\nHost: " OUR_SERVER
"\r\n\r\n";
void nettest_two(void)
{
err_t err;
struct ip_addr ipaddr;
u16_t len;
struct netbuf *buf;
char *rq;
int pos, line_count;
ipaddr.addr = inet_addr(OUR_SERVER);
/* ASSERT caused by the next line (I think) on second entry into this
function. */
err = netconn_connect(test_conn, &ipaddr, 80);
if (err == ERR_OK)
{
if (err == ERR_OK)
{
printf("netconn_connect OK.\r\n");
err = netconn_write(test_conn, (void *)&my_hdr,
sizeof(my_hdr),
NETCONN_NOCOPY);
if (err == ERR_OK)
{
printf("Written bytes OK.\r\n");
buf = netconn_recv(test_conn);
printf("Recv.\r\n");
if (buf != NULL)
{
do
{
netbuf_data( buf, (void **)&rq, &len
);
printf("*** Received %d bytes
***\r\n", len);
line_count = 0;
for (pos = 0; pos < len; ++pos)
{
printf("%c", rq[pos]);
++line_count;
if (line_count > 20)
{
printf("\r\n");
line_count = 0;
}
}
} while (netbuf_next(buf) >= 0);
}
}
}
netconn_close(test_conn);
}
else printf("netconn_connect failed.\r\n");
}
> Simon
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users