[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] making an example
From: |
Pavel Daniel Lopez Castillo |
Subject: |
[lwip-users] making an example |
Date: |
Thu, 28 May 2009 10:31:15 -0400 |
I want to make my own example
I want that when there is a connection on port 80
for example a telnet connection telnet 192.168.0.2 80
my application is able to print the size of what is sent by telnet
a server listening on port 80, which prints everything that you send
I was looking api reference and combine some codes
I am working with the port for linux in debian
My problem:
but I do not know how to run that, so far I have only run the binary contrib
module simhost
I need the steps to test my code
I try to alter the makefile contrib/ports/unix/proj/unixsim/makefile but it
gives me error
This is the code that I want test
void example_function(struct netconn *conn)
{
struct netbuf *buf;
int tamano;
while((buf = netconn_recv(conn)) != NULL) {
/*do_something(buf);*/
tamano = netbuf_len(buf);
printf("%d",tamano);
}
netconn_close(conn);
}
int main()
{
struct netconn *conn, *newconn;
conn = netconn_new(NETCONN_TCP);
netconn_bind(conn, NULL, 80);
netconn_listen(conn);
newconn = netconn_accept(conn);
/* do something with the connection */
example_function(newconn);
netconn_delete(newconn);
netconn_delete(conn);
}
<<winmail.dat>>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] making an example,
Pavel Daniel Lopez Castillo <=