[lwip-users] fundamentally flawed attempt at a TCP send
From:
sirnails
Subject:
[lwip-users] fundamentally flawed attempt at a TCP send
Date:
Wed, 16 Sep 2009 08:12:35 -0700 (PDT)
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