[Top][All Lists]

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

[lwip-users] Data sending problem over TCP

From: Sanchayan
Subject: [lwip-users] Data sending problem over TCP
Date: Wed, 22 Jun 2011 14:24:32 +0530

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 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.

Attachment: TCP.pcap
Description: Binary data

reply via email to

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