Tool/software: Linux
I am using Tiva Connected Launchpad(EK-TM4C1294XL) to take some ADC data from a sensor and send it to another system(Beaglebone Black, PC) over ethernet using TCP. On the Tiva side, I am using LwIP for the connection and on the system(PC) side, socket programming in python. I have provided static ip on both sides. I am directly connecting the ethernet wires between the Tiva launchpad and the system.
My relevant code for the Tiva board is shown below
typedef struct {
uint32_t pui32IPArray;
uint8_t pui8MACArray[8];
struct pbuf *p;
struct tcp_pcb *tpcb;
struct ip_addr server_ip, local_ip;
}Ethernet;
Ethernet eth0;
void tcp_initialize(void){
IP4_ADDR(ð0.server_ip, 169,254,0,1);
IP4_ADDR(ð0.local_ip, 169,254,0,2);
eth0.tpcb = tcp_new();
tcp_bind(eth0.tpcb, ð0.local_ip, 5002);
tcp_arg(eth0.tpcb, 0);
tcp_recv(eth0.tpcb, tcp_recv_callback);
tcp_sent(eth0.tpcb, tcp_sent_callback);
tcp_nagle_disable(eth0.tpcb);
tcp_connect(eth0.tpcb, ð0.server_ip, 5002, tcp_connected_callback);
}
int main(void){
lwIPInit(ui32SysClock, pui8MACArray, (169u<<24) | (254u<<16) | (0<<8) | 2, (255u<<24) | (255u<<16) | (0<<8) | 0, (0u<<24) | (0u<<16) | (0<<8) | 1, IPADDR_USE_STATIC);
tcp_initialize();
}
Even though it is working well for the Windows system(where I use Spyder to run python), it does not work for Ubuntu or Debian systems. The code does not go go beyond socket.accept(). The Python code at the PC side is shown below. My firewall is disabled on the Ubuntu system.
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(('169.254.0.1',5002))
s.listen(1)
conn, addr = s.accept()
print "connection address :", addr
So it gets stuck at s.accept() and could not connect. Please help me if I have to do something more to connect it to Linux than Windows.