beautypg.com

Ethernet functions, 6 ethernet functions – Solvline Eddy DK User Manual

Page 107

background image

Eddy DK Programmer Guide

107

6.6 Ethernet functions

These functions deal with the network-related information of Eddy.
These functions are optimized socket API for Eddy, and user can use other API for development by using his or her
own POSIX compatible standard socket API.

SB_GetIp

Function

Reads IP address assigned to Eddy.

Format

Unsigned int SB_GetIp (char *interface);

Parameter

Interface

Network interface name.
‚eth0‛ for WAN port.
‚eth1‛ for LAN port.

Returns

Unsigned int

returns IP address in unsigned int type.

Notice

Note that the function returns operating IP address, not the IP address
configured in Eddy. When Eddy is operating as a DHCP Client, this function
read network IP address assigned from DHCP server.
Please see below for transforming IP address into string type.
struct in_addr addr;
addr.s_addr = SB_GetIp ();
printf ("IP Address : %s ", inet_ntoa(addr));