Print IP adress

hi all,

I am new to blackfin561 in ethernet application I have connected my board(BF561) to my pc in linux environment through the network, I need to get ip adress of my board which is connected to the switch .how can my pc recognise the board and generate the ip adress.Is there any function or program are to be used .answers should be appreciated.

with regards ashu...

Reply to
ashu
Loading thread data ...

Gezundheit!

Reply to
Just me

I assume that your setup consists of a switch connected to the network with a DHCP server somewhere, the Blackfin board and your computer; I also assume that Blackfin gets its IP settings through DHCP.

You could run wireshark or tcpdump on your linux box and watch the DHCP broadcast traffic to your board when you power it up. You could see all traffic if you placed both your computer and the board on a simple hub---a useful thing to have, and I keep a couple of old hubs around for just this purpose.

Reply to
przemek.klosowski

You may either use ifconfig or the following piece of code (exchange "eth0" for the device in use):

--cut-- #include #include #include #include #include

int main(int argc, char **argv) {

struct ifreq myifr; struct hostent *h; int i; char *dot;

sprintf(myifr.ifr_ifrn.ifrn_name,"%s", "eth0"); /* get IP address and write to nameip */ ioctl(socket(AF_INET, SOCK_DGRAM, IPPROTO_IP), SIOCGIFADDR, &myifr);

dot=""; for(i=0; i

Reply to
Sven Geggus

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.