Hi,
I've run your code, with a few changes. I am able to have TCP communication.
First thing I noticed was the large amount of data you're sending 
[netconn_write(conn, (const unsigned char*)(TXData), (size_t)(1500)), 
NETCONN_NOCOPY);] is this causing some overflow?

Next step would be checking the configuration. Is there some kind of firewall 
active between the 2 devices? And do you have enough memory assigned i.e. 
enough netbuffs/netconns etc. in lwipoprts?

Altered code, pardon my goto's but it's a quick test:
void client_netconn_thread(void* pvParam){
  ip_addr_t DEST_IP;
  struct netconn *conn = NULL;
  struct netbuf *incoming;

  IP4_ADDR(&DEST_IP, XXX, XXX, XXX, XXX);

  conn = netconn_new(NETCONN_TCP);

  if(conn != NULL){
    if (ERR_OK != netconn_bind(conn, NULL, MODBUS_PORT))
      goto err;
    if (ERR_OK != netconn_connect(conn, &DEST_IP, MODBUS_PORT))
      goto err;
  }
  while(true){
    if (ERR_OK != netconn_write(conn, "request", 8, NETCONN_NOCOPY))
      goto err;
    vTaskDelay(500);
    if (ERR_OK != netconn_recv(conn, &incoming))
      goto err;
    if (netconn_err(conn) == ERR_OK){
      netbuf_delete(incoming);
    }
  }

err:
  netconn_close(conn);
  netconn_delete(conn);
  vTaskDelete(NULL);
}



>

​
Met vriendelijke groet / Kind Regards
Ricardo Schoof
Embedded Software Engineer

Orga BV
Strickledeweg 13
​3125 AT Schiedam
​The Netherlands

T: +31(0)10 208 5555
F: +31(0)10 437 8445
E: [email protected]
http://www.orga.nl

Come visit us and experience our Helideck lighting and Aids to navigation 
solutions live at the OTC (booth 1739-D) in Houston (US) from 6 till 9 May 2019!

Any information transmitted by means of this e-mail (and any of its 
attachments) is intended exclusively for the addressee or addressees and for 
those authorized by the addressee or addressees to read this message. Any use 
by a party other than the addressee or addressees is prohibited. The 
information contained in this e-mail (or any of its attachments) may be 
confidential in nature and may fall under a duty of non-disclosure.
Orga BV shall not be liable for damages resulting from the use of electronic 
means of communication, including - but not limited to - damages resulting from 
failure or delay in delivery of electronic communications, interception or 
manipulation of electronic communications by third parties or by computer 
programs used for electronic communications and transmission of viruses and 
other malicious software. Orga BV is seated in Schiedam, registered at the 
Chamber of Commerce under number 24230253 and carries the following VAT number 
NL006913842B01
-----Original Message-----
> From: lwip-users <[email protected]> On
> Behalf Of tirmalabenikasibeni
> Sent: Tuesday, 30 April 2019 14:44
> To: [email protected]
> Subject: Re: [lwip-users] TCP Client handshakes but no data transmission
>
> I've changed my code like this:
>
> void client_netconn_thread(void){
>   ip_addr_t DEST_IP, LOC_IP;
>   err_t err0, err2;
>   struct netconn *conn;
>   struct netbuf *incoming;
>   char* buf;
>   Ui16 buflen, i;
>
>   IP4_ADDR(&LOC_IP, IP_ADDR0, IP_ADDR1, IP_ADDR2, IP_ADDR3 );
>   IP4_ADDR(&DEST_IP, DEST_IP_ADDR0, DEST_IP_ADDR1, DEST_IP_ADDR2,
> DEST_IP_ADDR3);
>
>   conn = netconn_new(NETCONN_TCP);
>
>   if(conn != NULL){
>     err0 = netconn_bind(conn, &LOC_IP, MODBUS_PORT);
>     netconn_connect(conn, &DEST_IP, MODBUS_PORT);
>   }
>   if((err0 == ERR_OK)){
>     while(TRUE){
>       netconn_write(conn, (const unsigned char*)(TXData), (size_t)(1500),
> NETCONN_NOCOPY);
>       osDelay(10);
>       err2 = netconn_recv(conn, &incoming);
>       if(err2 == ERR_OK){
>         if (netconn_err(conn) == ERR_OK){
>             netbuf_data(incoming, (void**)&buf, &buflen);
>
>             for(i=0; i<buflen; i++){
>               RXData[i] = *(Ui08 *)buf;
>               buf++;
>             }
>             netbuf_delete(incoming);
>           }
>       }
>     }
>   }
>   else netconn_delete(conn);
> }
>
> But result is the same, nothing changed. PCAPs has no difference.
>
> Thanks.
>
>
>
> --
> Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
>
> _______________________________________________
> lwip-users mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: tcp.pcapng
Description: tcp.pcapng

_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to