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 );
out = netconn_new( NETCONN_TCP );
netconn_bind( out , NULL , LOCAL_PORT );
IP4_ADDR( &connectIP, 134, 28, 56, 14);
while( 1 ) {
err = netconn_connect( out , &connectIP , SERVER_PORT );
if( err == ERR_OK )
break;
else {
netconn_close( out );
netconn_delete( out );
out = netconn_new( NETCONN_TCP );
netconn_bind( out , NULL , LOCAL_PORT );
}
vTaskDelay( 50 );
}
Thanks in andvance for help.