相关讨论
我对linux不熟,现在想学习一下
但是 单位的 ip 都是动态分配的
不知道在linux下怎么自动获取ip
谢谢各位
#include
#include
int main()
{
FILE *fpr;
char devicecfg[50];
char *device="eth0";
sprintf(devicecfg,"/etc/sysconfig/network-scripts/ifcfg-%s",device);
char buf[1024],*p;
int i;
char gwip[20]={0};
if((fpr=fopen(devicecfg, "r"))==NULL)
{
printf("open device config faile\n");
return -1;
}
memset(buf, 0, sizeof(...
网络技术
最近在做linux平台下用C语言实现ip地址的自动获取和静态获取,目前我只做了静态获取ip,但不懂得怎么实现自动获取ip,希望高手能够指点迷津,谢谢了。
注:
我是要在开发板上实现ip动态获取的,不是在PC机上动态获取,dhcp服务在开发板上如何安装和配置,有做过类似的高手请指教。
[ 本帖最后由 hxh88888888 于 2009-8-24 10:14 编辑 ]
如何在linux bridge 中通过MAC地址获取到ip地址呢?
类似于在线状态用户功能的实现
查了下资料没查到什么函数。
哪位知道的指点一下,非常感谢!
代码如下:
[code]
#include
//#include
#include
#include
#include
#include socket.h>
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc, char **argv)
{
int sockfd;
char *ptr;
struct ...
请问 linux从win2000动态获取ip如何在linux知道分配请矿
如题,我要根据主机名称找到主机对应ip地址,有这方面的命令吗?
。。。。。。。
为什么本帖被关闭?!斑竹为啥啊!
[ 本帖最后由 jinyonghe 于 2008-9-18 22:32 编辑 ]
在windows下会提示输入密钥,可是在linux下根本没有这个.所以直接导致无法获取ip.不能建立连接.
在/etc/sysconfig/network-scripts/ifcfg-wlan0文件中有没有相关的参数可以指定密钥?
谢谢!
用gethostname,gethostbyname,之后 只能获取一个ip