lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Data sending problem over TCP


From: Sanchayan
Subject: Re: [lwip-users] Data sending problem over TCP
Date: Sat, 25 Jun 2011 13:02:32 +0530

Hello,

I have a TCP application, basically i am using the TCP Test Tool to send data. I have written the code for my LM3S6965 board, which listens for incoming connections on a particular port and takes the data received. This data, which is basically a command, which i then send to a module connected over a serial port. Till, this point, i have no problems. Now, the module responds back. The module's response, i want to send back on the same connection. What should i do to achieve this. For this, i do

// this buffer length can vary anything between 25 to 5000 bytes. Rite, now though i am sending a few bytes only
tcp_write( pcb, buff, buff_length, 0 );

tcp_output( pcb );

where pcb is the same Protocol Control Buffer which, i had alloted for the connection over which i received the data in the first place. I know, i am doing something wrong, since tcp_write gives me a written value -8, which is not connected, but i cannot figure out, as i can send the data from the TCP Test Tool, but the above thing doesn't work. The connection is active all the while. So, can someone help me out how i am to send data, for this case.

Also, looking at another lwip reentrancy issue post, has got me worried over what i did and am doing, is gonna bring lot of problems later on somehow and is there any documentation available on how to use lwip for carrying out necessary tasks at the RAW API level, so that i can learn how to use it effectively, as whatever i have done till now has been by looking at the code examples given with LM3S6965.

Thanks & Best Regards,
Sanchayan Maity.


----- Original Message ----- From: "Kieran Mansley" <address@hidden>
To: "Mailing list for lwIP users" <address@hidden>
Sent: Thursday, June 23, 2011 18:48
Subject: Re: [lwip-users] Data sending problem over TCP


On Thu, 2011-06-23 at 15:10 +0530, Sanchayan wrote:

I have attached the wireshark .pcap file. And also a screenshot of
wireshark.

That shows that the connection is being rejected by the host you're
trying to connect to, probably because there is nothing listening on
that port number.

This should result in the tcp_err() callback being triggered to notify
you that the connection has failed.  If it had succeeded the connected
callback that you can pass to tcp_connect() would be called, but I
notice that you're just giving it NULL instead.  If you take a look in
doc/rawapi.txt there's a section there on how to use tcp_connect():

- err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
                   u16_t port, err_t (* connected)(void *arg,
                                                   struct tcp_pcb
*tpcb,
                                                   err_t err));

 Sets up the pcb to connect to the remote host and sends the
 initial SYN segment which opens the connection.

 The tcp_connect() function returns immediately; it does not wait for
 the connection to be properly setup. Instead, it will call the
 function specified as the fourth argument (the "connected" argument)
 when the connection is established. If the connection could not be
 properly established, either because the other host refused the
 connection or because the other host didn't answer, the "err"
 callback function of this pcb (registered with tcp_err, see below)
 will be called.

 The tcp_connect() function can return ERR_MEM if no memory is
 available for enqueueing the SYN segment. If the SYN indeed was
 enqueued successfully, the tcp_connect() function returns ERR_OK.

Kieran


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



Disclaimer: This message (including any attachments) contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action based on the contents of this information is strictly prohibited. If you have received this email in error please notify address@hidden Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Godrej & Boyce Mfg. Co. Ltd. group of companies. The recipient should check this email and any attachments for the presence of viruses. Godrej & Boyce Mfg. Co. Ltd. group of companies accepts no liability for any damage caused by any virus transmitted by this email.



reply via email to

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