AnsweredAssumed Answered

LPC4330 Xplorer Board aborted the connection via lwIP

Question asked by eugenr on Jun 7, 2017
Latest reply on Jun 11, 2017 by jeremyzhou

I'm trying to connect the LPC4330 Xplorer Board to my computer via ethernet TCP/IP. The board is the Client, which supposed to send data to my computer, which is the server, which I programmed with python.

 

This is the python server:

 

import socket
import sys

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
   s.bind(('134.28.56.14', 12693))
except socket.error as msg:
   print("{}".format(str(msg)))
   sys.exit()
s.listen(1)
try:
   while True:
      conn, addr = a.accept()
      while True:
         data = conn.recv(1024)
         if not data:
            conn.close()
            break
finally:
   s.close()

I am using lwIP and netconn_connect() always returns ERR_ABRT, which makes no sense to me since it is the right port and the correct IP Adress which I am using.

 

This is the conection part:

static void tcpTxThread( void *arg )
{
struct netconn *out;
err_t err;
ip_addr_t connectIP;
portTickType lastWakeTime;
uint8_t sendBuffer[ 1500 ];
struct netbuf *netBuffer;
size_t sendSize = 0;
uint16_t lengthOfData = 0;
char *pcRxString;
LWIP_UNUSED_ARG( arg );
/* Create new connection identifier. */
out = netconn_new( NETCONN_TCP );
/* bind connection to port 10 */
netconn_bind( out , NULL , LOCAL_PORT );
/* Set the IP address from the server for the connection */
IP4_ADDR( &connectIP, 134, 28, 56, 14);

while( 1 ) {/* Try to connect to the server */
    err = netconn_connect( out , &connectIP , SERVER_PORT );
    if( err == ERR_OK )
       break;
    else {/* If the connection could not be established, rebind the netconn-interface and try again */
       netconn_close( out );
       netconn_delete( out );
       out = netconn_new( NETCONN_TCP );
       netconn_bind( out , NULL , LOCAL_PORT );
       }
   /* Try again every 50 milliseconds */
    vTaskDelay( 50 );
}

 

Thanks in andvance for help.

Outcomes