Hi
There is a file in RTCS library called RTCShosts.c which has
const HOST_ENTRY_STRUCT RTCS_Hosts_list[] =
{
/* IP Address Host Name Aliases */
{ 0x7F000001, "localhost", 0 },
{ 0xC0A80001, "www.arc.com", {"www"} },
{ 0xFFFFFFFF, "broadcast", 0 },
{ 0, 0, 0 },
};
is this the file similar to /etc/hosts which we have in Linux based system , so entry here will make us the hostname to IP conversion .
I checked the RTCS document nothing mentioned on this file and also on the structure HOST_ENTRY_STRUCT;
typedef struct host_entry_struct
{
uint_32 ip_address;
char_ptr host_name;
char_ptr aliases[MAX_HOST_ALIASES+1];
} HOST_ENTRY_STRUCT;
Is this needed so we put a entry if we try to access from the http using the hostname or telent using the hostname it makes the necessary NAT .
Please put your limelight on the matter .
regards
vallinath
Yes, it is very similar to Linux system.
If task call getaddrinfo() function, this function will look at RTCS_Hosts_list[] and in case of no match it will ask DNS server for IP address.
So, you can use RTCS_Hosts_list[] for defining static IP addresses…
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Radek
Thanks for the Reply , So if it has /etc/hosts.c file then if we have enter ,
Hostname , IPaddress then can we use \
use hostname to launch the webpage http://hostname instead of http://ipaddress
use telnet hostname
use ftp hostname
So in telnet ,HTTP, FTP server implementation on MQX code is this taken care or we need add this to achieve the desire result .
regards
vallinath
Yes and no.
Functionality of definitions in RTCShosts.c is not limited by any communication protocol. Names like “localhost” will be taken into account only in case when code calls function getaddrinfo().
For example Shell_ping (sh_ping.c file) or Shell_smtp(sh_smtp.c) functions uses getaddrinfo(), therefore you should be able ping localhost with this function directly…
Hi radek
Thanks again !!! will try that and also will add getaddrinfo in Telnet code and will check it .
I have little bit more information . I need to make the MQX device in private LAN reachable to public IP address .
Mqx device IP: 192.168.10.5 : http://192.168.10.5:80 able to access webpage ie in private LAN
I have router where port forwarding is enabled and port 80 is forwarded to 192.168.10.5 port 80 .
Now if i use the http://publicipaddress:80 not able to reach the MQX device .
so is there any other configuration neeed to made on MQX device to get the request such as ENABLE GATEWAY functionality or VIRTUAL ROUTE functionality
can you put some lime light on this
regards
vallinath
If you want access MQX device from internet, you have to manage public IPv4 address for MQX device or you need additional device with public IPv4 address which will translate communication between MQX device and external network. (Third option is IPv6...)
For second case, you should not need any additional modification when it correctly works on local network. However it depends on router intelligence – how it manages this translation…
Anyway, when you add gateway address to RTCS stack, RTCS will first check destination address whether it is from current LAN and if not, it will send data directly trough gateway. So, adding gateway could help you in this case, but everything depends on your router and network structure…
In this case I would like to recommend using Wireshark for packet analysis. You can see whether request from internet was correctly forwarded to MQX device IP address and whether MQX device correctly answered…