Re: [問題] 請問應用程式如何取得網路裝置

看板LinuxDev作者 (呈呈)時間17年前 (2007/10/19 10:15), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/5 (看更多)
※ 引述《ILYUJING (蟹)》之銘言: : 我想在user-space下利用ioctl取得網路裝置的資訊 : ioctl的系統呼叫如下: : int ioctl( int fd, int cmd, ...); : 關於fd我應該怎麼取得? : 我的意思是我怎麼在應用程式下開啟網路裝置? : 以及我需要include哪些lib? : #include<stdio.h> : ? : int main() { : int fd = ? : struct ifreq data; : .... : ioctl(fd,cmd,&data); : return 0; : } : ※ 編輯: ILYUJING 來自: 140.124.183.77 (10/18 20:47) : → prudent:網路的fd,不就是用 socket 函式嗎! 是指這個嗎? 10/18 23:36 fd -> socket descriptot #include <sys/types.h> #include <sys/socket.h> fd = socket(domain, type, proctol); ref. "man socket" #include <sys/iotcl.h> ioctl(fd, cmd, &data); ref. "man ioctl" man socket 跟 man ioctl 你可以了解更多 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.250.246.16
文章代碼(AID): #1761D8iO (LinuxDev)
文章代碼(AID): #1761D8iO (LinuxDev)