[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] RE: [lwip] Port to uCOS-II
From: |
DASILVA VINCENTE BIT |
Subject: |
[lwip-users] RE: [lwip] Port to uCOS-II |
Date: |
Wed, 08 Jan 2003 22:39:00 -0000 |
Perhaps you can help me with the following:
If I start 2 processes using the function loopif() am I correct to assume
that the tcpecho_thread will create a connection on port 7 address 127.0.0.1
and start listening.
tcpwrite_thread process is then created and creates a connection on port 8
address
127.0.0.1 and then sends the text "Test" to port 7 address 127.0.0.1. At
this point tcpecho_thread will continue and should receive the data "Test".
The problem is that the tcpecho_thread is never re-started i.e. The data
never reaches the mbox of the tcpecho_thread connection.
I think maybe I have a problem with the way I am using the API.
Thanks in advance
Vicente
static void loopif()KCREENTRANT
{
struct ip_addr ipaddr, netmask, gw;
OS_EVENT* sem;
IP4_ADDR(&gw, 127,0,0,1);
IP4_ADDR(&ipaddr, 127,0,0,1);
IP4_ADDR(&netmask, 255,0,0,0);
netif_set_default(netif_add(&ipaddr, &netmask, &gw,
loopif_init,tcpip_input));
sem = sys_sem_new(0);
tcpip_init(tcpip_init_done, sem);
sys_sem_wait(sem);
sys_sem_free(sem);
sem = sys_sem_new(0);
tcpecho_init(sem);
sys_sem_wait(sem);
sys_sem_free(sem);
tcpwrite_init();
sem = sys_sem_new(0);
sys_sem_wait(sem);
}
static void
tcpwrite_thread(void *arg)KCREENTRANT
{
struct netconn *conn;
struct ip_addr ipaddr;
char text[] = "Test";
OS_EVENT* sem;
IP4_ADDR(&ipaddr, 127,0,0,1);
conn = netconn_new(NETCONN_TCP);
netconn_bind(conn, &ipaddr, 8);
netconn_connect(conn,&ipaddr, 7);
netconn_write(conn, text, sizeof(text), NETCONN_NOCOPY);
netconn_close(conn);
sem = sys_sem_new(0);
sys_sem_wait(sem);
}
static void
tcpecho_thread(void *arg)KCREENTRANT
{
struct netconn *conn, *newconn;
err_t err;
struct ip_addr ipaddr;
OS_EVENT* sem;
IP4_ADDR(&ipaddr, 127,0,0,1);
conn = netconn_new(NETCONN_TCP);
netconn_bind(conn, &ipaddr, 7);
sys_sem_signal((OS_EVENT *)echo_ready_arg);
netconn_listen(conn);
while(1)
{
// Grab new connection.
newconn = netconn_accept(conn);
if(newconn != NULL)
{
struct netbuf *buf;
void *data;
u16_t len;
while((buf = netconn_recv(newconn)) != NULL)
{
do
{
netbuf_data(buf, &data, &len);
//err = netconn_write(newconn, data, len, NETCONN_COPY);
//if(err != ERR_OK)
//{
/* printf("tcpecho: netconn_write: error \"%s\"\n",
lwip_strerr(err));*/
//}
} while(netbuf_next(buf) >= 0);
netbuf_delete(buf);
}
netconn_delete(newconn);
}
}
}
Vicente
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] Port to uCOS-II, Konrad, Guido, 2003/01/08
- [lwip-users] RE: [lwip] Port to uCOS-II, DASILVA VINCENTE BIT, 2003/01/08
- [lwip-users] RE: [lwip] Port to uCOS-II, Mikael Lundberg, 2003/01/08
- [lwip-users] RE: [lwip] Port to uCOS-II,
DASILVA VINCENTE BIT <=
- [lwip-users] Re: [lwip] Port to uCOS-II, Ganesh S, 2003/01/08
- [lwip-users] RE: [lwip] Port to uCOS-II, DASILVA VINCENTE BIT, 2003/01/08
- [lwip-users] Re: [lwip] Port to uCOS-II, Bill Knight, 2003/01/09
- [lwip-users] Re: [lwip] Port to uCOS-II, Taco Walstra, 2003/01/09
- [lwip-users] RE: [lwip] Port to uCOS-II, DASILVA VINCENTE BIT, 2003/01/09
- [lwip-users] Re: [lwip] Port to uCOS-II, Adam Dunkels, 2003/01/09