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: Tim Lambrix
Subject: Re: [lwip-users] Data sending problem over TCP
Date: Wed, 22 Jun 2011 15:15:44 +0000

The Stellaris examples run the lwIP from an interrupt context so be careful when and where you try to call data outside of the interrupt context.

 

From: lwip-users-bounces+address@hidden [mailto:lwip-users-bounces+address@hidden On Behalf Of Sanchayan
Sent: Wednesday, June 22, 2011 7:35 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Data sending problem over TCP

 

Hello,

 

There will be a web server, but data will also have to be send from a different context in my project, other than the web server. The web server i have already implemented.

 

Thanks & Best Regards,
Sanchayan Maity.


----- Original Message -----

From: Tim Lambrix

Sent: Wednesday, June 22, 2011 16:44

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

 

I am no expert with lwIP but should a server be calling the tcp_connect function?  I thought the server just listened for client connects.

 

Take a look at the example code for the enet_lwip example project in the LM3S6965 Eval board as the project is set up to be a simple example web server. 

 

From: lwip-users-bounces+address@hidden [mailto:lwip-users-bounces+address@hidden On Behalf Of Sanchayan
Sent: Wednesday, June 22, 2011 4:55 AM
To: lwip
Cc: Hemant
Subject: [lwip-users] Data sending problem over TCP

 

Hi,

 

I am trying to implement a web server with lwip on LM3S6965 Stellaris Cortex M3 Micro Controller and also need to sent anywhere from 25 to 4000 bytes of data over TCP from my board. Right now, i am trying to send a few bytes of data, on a switch press over the board, but i am not being able  to send it. I can't see my packets in Wireshark. Below is the code, i have written. Can someone help me out, as to what i am doing wrong or additonal things i need to do. Attached is the wireshark file, when the function gets executed. This is all i get.

 

unsigned char buff[25];

struct tcp_pcb *my_pcb;

void send_my_data( void );
static void close_my_conn( struct tcp_pcb *pcb );

 

void send_my_data( void )                   // This function gets called when i press the switch.
{
     unsigned long myipaddr;

     err_t err;
     err_t write_error;

     struct ip_addr ipaddr; 

     myipaddr = 0x0A110258;  // The IP address 10.17.2.88 to which i need to send the data

     ipaddr.addr = htonl( myipaddr ); 
     buff[0] = 0x31;
     buff[1] = 0x32;
     buff[2] = 0x33;
     buff[3] = 0x34;
     buff[4] = 0x35;
     buff[5] = 0x36;                 // The data i need to send

 

     my_pcb = tcp_new();

 

     tcp_bind( my_pcb, IP_ADDR_ANY, 2101 );                                      // Bind to any local address the board has been assigned

 

     err = tcp_connect( my_pcb, &ipaddr, 2101, NULL );
  
     write_error = tcp_write( my_pcb, buff, 6, 0 );                                     // I Get a return value of 0 for both err and write_error when i check in my Keil debugger for MCU
 
     tcp_output( my_pcb );                                                                    // I need to send the 6 bytes in buff array over TCP
  
     if( ( err == ERR_MEM ) & ( write_error ) )
     {
          close_my_conn( my_pcb ); 
     }      
}
static void close_my_conn( struct tcp_pcb *pcb )
{
    tcp_arg( pcb, NULL );
    tcp_sent( pcb, NULL );
    tcp_recv( pcb, NULL );
    tcp_close( pcb );
}

 

Thanks & Best Regards,
Sanchayan Maity.

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.


_______________________________________________
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]