[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] problem with netconn_accept
From: |
shobhit saxena |
Subject: |
[lwip-users] problem with netconn_accept |
Date: |
Thu, 8 Feb 2007 06:19:56 -0500 |
hello everyone,
i am using arm e7t board with ecos cofig tool & my
target is to establish LWIP-TCP/IP over PPP & have communication
between a server and ARM kit(client).I am using the lwip_init()
function to establish PPP connection.I am using the following code for
establishing TCP/IP .
my problem is that the program is running fine till the line
"newconn=netconn_accept(conn);"
but its not accepting connection.Is there something wrong with my code?
Is there any function to check the ip address that is being used?
static void simple_prog(CYG_ADDRESS data)
{
cyg_io_handle_t handle1;
cyg_io_lookup( "/dev/ser0", &handle1);
lwip_init();
printf("\nConnected PPP\n");
struct netconn *conn, *newconn;
err_t err;
struct ip_addr *addr;
unsigned short port;
conn = netconn_new(NETCONN_TCP);
cyg_thread_delay(50);
int bind_result = netconn_bind(conn, NULL, 2506);
//int bind_result = netconn_bind(conn,"192.168.0.4",2506);
cyg_thread_delay(50);
printf("\nBind to port 2506: [%d]", bind_result);
int listen_result = netconn_listen(conn);
cyg_thread_delay(50);
printf("\nListening: [%d]\nPress any key to begin accepting.",
listen_result);
getchar();
cyg_thread_delay(100);
int netconn_peer_result;
netconn_peer_result = netconn_peer(conn,NULL, NULL);
printf("\nEntering while loop");
while(1) {
printf("\nInside while loop");
// --FROM HERE THE PROBLEM STARTS--//
newconn=netconn_accept(conn);
cyg_thread_delay(50);
printf("\nAccept: [%d]", newconn);
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) { }
} while(netbuf_next(buf) >= 0);
netbuf_delete(buf);
}
netconn_delete(newconn);
}
}
}
void cyg_user_start(void)
{
cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
(void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
cyg_thread_resume(thread[0]);
cyg_scheduler_start();
}
- [lwip-users] problem with netconn_accept,
shobhit saxena <=