Specifying network interface for the listen( ) on MOD54417

Discussion to talk about software related topics only.
Post Reply
rlupish
Posts: 26
Joined: Thu Oct 10, 2013 6:15 am

Specifying network interface for the listen( ) on MOD54417

Post by rlupish »

For the MOD54417, NNDK 2.7.1, there seems to be no way to restrict the TCP listen( ) (or accept( )) function to "listen" for connect requests on only one or the other of the two Ethernet interfaces. At the moment for us, this is actually an advantage, as we wish to accept a connection on either interface, but I'm curious as to whether other users have found this to be an issue.

What is interesting is that the TCP connect( ) function does appear to optionally allow for specifying the interface to use by supplying the IP address of that interface.

Ron
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Specifying network interface for the listen( ) on MOD544

Post by rnixon »

For listen and accept, you check which interface it came from in your functions that process them. That's how the multi interface example works to display a web page from one interface or the other. For making a connection, I have not used it, but there is a connectvia() function in the manual that lets you pick one or the other.
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Specifying network interface for the listen( ) on MOD544

Post by pbreed »

If submit a support request we will send you a patch that adds:

int listen_on_interface(IPADDR addr, WORD port, BYTE maxpend, IPADDR interfaceIpAddress )


Paul
Post Reply