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.
Hi jeremyzhou,
I did it already and I have an equal system already running on the raspberry pi. That is also why I am so confused about it. The only difference between those two are that I wrote the server program on the computer with python and on the raspberry pi its made with C.
Have a great day.
Hi eugenr,
Thanks for your reply.
Whether you use some softwares likes the Wireshark to exemplify communication between the client and server.
I think it's good method to figure the root cause of the issue.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi eugenr,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------