lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] fundamentally flawed attempt at a TCP send


From: Bill Auerbach
Subject: RE: [lwip-users] fundamentally flawed attempt at a TCP send
Date: Wed, 16 Sep 2009 11:27:22 -0400

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: address@hidden [mailto:address@hidden On Behalf Of sirnails
Sent: Wednesday, September 16, 2009 11:13 AM
To: address@hidden
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 flawed attempt at a TCP send
Sent from the lwip-users mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]