This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Change IP during run-time...again
- From: "Daniel Lidsten" <Daniel dot Lidsten at combitechsystems dot com>
- To: <sebastien dot couret at elios-informatique dot fr>, <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 12 Mar 2004 10:28:04 +0100
- Subject: [ECOS] Change IP during run-time...again
Hi,
I have tried to do change the IP using init_net instead of ioctl.
When i startup my board then it has a predefined IP: 192.168.0.1. I then
try to change it with the below code. However, the strange thing is that
when i am sending data then the source address of all packages are set
to the old address, after i have made the init_net call. How come?
Have i missed some init call that has to be executed for these changes
to take effect?
Regards, Daniel Lidsten
-----------
const char *eth0_name = "eth0";
const char *eth0_ipaddr = "192.168.0.10";
const char *eth0_netmask = "255.255.255.0";
const char *eth0_broadcast = "192.168.0.255";
const char *eth0_gateway = "192.168.0.254";
const char *eth0_server = "192.168.0.30";
//Create new socket and send UDP data on port 1000
SendUDPdata(1000);
build_bootp_record(ð0_bootp_data,
eth0_name,
eth0_ipaddr,
eth0_netmask,
eth0_broadcast,
eth0_gateway,
eth0_server );
if (!init_net(eth0_name, ð0_bootp_data))
printf("Network initialization failed for eth0\n");
//Create new socket and send UDP data on port 2000
SendUDPdata(2000);
-----------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss