MOD54417 dual ethernet TCP connect
Posted: Tue Oct 07, 2014 8:58 am
So I've been trying to figure out how to work with the second ethernet interface on the MOD54417 and I'm having a little trouble. I'm surprised the latest NNDK didn't come with an example on how to differentiate between the two.
I tried to make a test setup where it would act as a DHCP client through one port and set a static address on the other and act as a DHCP server. I couldn't find much to go on so I took a shot in the dark.
I started out getting the DHCP address like normal and I tried adding a static interface based on the interface number returned by Add2ndEthernet(). Then I started a DHCP server on that interface.
Up to this point everything appears to be working. It assigns addresses out the second port and accepts incoming connections to the static address on the port. The problem comes when I try to make an outgoing connection on that port using the static address I set up.
This times out. The destination adress and port are all correct and the other processor is listening for the connection.
So my question is how to I distinguish which of the ethernet ports to use for a connect call.
I tried to make a test setup where it would act as a DHCP client through one port and set a static address on the other and act as a DHCP server. I couldn't find much to go on so I took a shot in the dark.
I started out getting the DHCP address like normal and I tried adding a static interface based on the interface number returned by Add2ndEthernet(). Then I started a DHCP server on that interface.
Code: Select all
GetDHCPAddress();
int intf2 = Add2ndEthernet();
int numInterfaces = AddInterface( AsciiToIp( "192.168.1.2" ), AsciiToIp( "255.255.255.0" ), 0, intf2 );
if(!AddStandardDHCPServer(intf2))
{
iprintf("\r\nfailed to start DHCP");
}
else
{
iprintf("\r\nDHCP started");
}
Code: Select all
fd = connectvia( dest_ipaddr, 0, ANALYZER_COMM_INCOMING_PORT, TICKS_PER_SECOND *3, AsciiToIp( "192.168.1.2" ) );
So my question is how to I distinguish which of the ethernet ports to use for a connect call.