- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have tried successfully LWIP standalone downloaded from And I tried to write simple program using LWIP stand alone to receive data from PC. My program just try to connect to server run on PC and then receive data sent by that server. static err_t receiver_recv( void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) { char *data; ............ return ERR_OK; } /*-----------------------------------------------------------------------------------*/ static err_t receiver_connected( void *arg, struct tcp_pcb *pcb, err_t err) { u16_t len; err_t error; struct receiver_state *rcvs; printf("\nerr %d\n", err); char *init = "GET"; len = strlen( init); rcvs = mem_malloc(sizeof(struct receiver_state)); if( rcvs == NULL) { printf("\nMalloc error"); return ERR_MEM; } rcvs->len = 0; if( err == ERR_OK) { printf("\nWow! We have been connecting"); tcp_arg( pcb, rcvs); error = tcp_write( pcb, init, len, 0); tcp_sent( pcb, receiver_sent); tcp_recv( pcb, receiver_recv); tcp_err( pcb, receiver_err); tcp_poll( pcb, receiver_poll, 10); return ERR_OK; } else { return err; } } /*-----------------------------------------------------------------------------------*/ void receiver_init(void) { int i; struct tcp_pcb *pcb; IP4_ADDR(&remote_addr, IPADDR0, IPADDR1, IPADDR2, IPADDR3); pcb = tcp_new(); if( pcb == NULL) { printf("\nNot enough memory to create new connection\n"); return ERR_MEM; } printf("\nCreat pcb successfully"); err = tcp_connect( pcb, &remote_addr, REMOTE_PORT, receiver_connected); if( err == ERR_OK) .... else if ( err = ERR_MEM) .... else ...... } But I found that it never go to receiver_connected function! Because I've just tried with LWIP standalone a little, while I am still trying to find errors, I'd like to ask if someone could show me where I am wrong? Or if you have any (simple) client example using LWIP standalone, could you please post here or send me by email? hoangviet5012001@yahoo.com. Thanks for your help! Viet.Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page