First, the ip address isn't a constant, but a struct ip_addr *. Your code may well compile, but you should observe and correct the warnings. The last parameter to tcp_connect should simply be the name of the function which lwIP will callback when the connection is made. This is should not be a function call. The tcp_write would occur after you are notified of the connection (by the callback to tcp_connect).
Bill From: [email protected] [mailto:[email protected]] On Behalf Of sirnails Sent: Wednesday, September 16, 2009 11:13 AM To: [email protected] Subject: [lwip-users] fundamentally flawed attempt at a TCP send Hello All, I am trying to send a string over TCP and believe i am having fundamental understanding problems... The code i am trying to cobble together (based upon http://www.nongnu.org/lwip/) is: _____ struct tcp_pcb *pcb; static char indexdata[] = "DAVE"; pcb = tcp_new(); /* Create a new TCP PCB. */ tcp_bind(pcb, NULL, 44444); /* Bind the PCB to TCP port 80. */ tcp_connect(pcb,0xC0A821AF,55555,tcp_write(pcb, indexdata, sizeof(indexdata), 1)); tcp_close(pcb); _____ a few questions: - what is a PCB (Protocol Control Block) and what is it for? is it just a unique reference number for the specific connection? - the code compiles correctly but when run gives a SIGSEGV fault : _____ Program received signal SIGSEGV, Segmentation fault. 0x02005d48 in tcp_connect (pcb=0x2013d90, ipaddr=0xc0a821af, port=55555, connected=0xfffffffa) at ../lwip/src/core/tcp.c:425 425 pcb->remote_ip = *ipaddr; _____ Im sorry to be asking such a stupid question, I hope you can help! Dave xx _____ View this message in context: fundamentally <http://www.nabble.com/fundamentally-flawed-attempt-at-a-TCP-send-tp25474522 p25474522.html> flawed attempt at a TCP send Sent from the lwip-users <http://www.nabble.com/lwip-users-f7923.html> mailing list archive at Nabble.com.
_______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
