get computer IP problem
조회 수: 49 (최근 30일)
이전 댓글 표시
I use command [status,result] = system('arp -a'), to get the IP address of my computer. there are lots of IP in the variable 'result', such as dynamic, staticstic, etc.
meanwhile, the result are also found to be different at different day. for example, using the same command, the variable 'result' is different between yesterday and today.
just want know what paramters in the 'result' is fixed in the machine, which will not changed with time?
Thanks!
Yu
댓글 수: 3
Stephan
2018년 11월 7일
Another way to get the MAC adress easily:
cui,xingxing
2024년 8월 30일
using following matlab code to get computer IP address
% Use Java's InetAddress class to get the local host
host = java.net.InetAddress.getLocalHost();
% Get the IP address as a string
ipAddress = char(host.getHostAddress());
% Display the IP address
disp(['Local IP Address: ', ipAddress]);
채택된 답변
Stephan
2018년 11월 6일
편집: Stephan
2018년 11월 6일
Hi,
try:
[~, result] = system('ipconfig')
result:
Windows-IP-Konfiguration
Ethernet-Adapter LAN-Verbindung:
Verbindungsspezifisches DNS-Suffix: **.*********.de
IPv4-Adresse . . . . . . . . . . : **.***.**.**
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : **.***.**.*
for more detailed information use:
[~, result] = system('ipconfig -all')
The arp gives the adress Resolution protocoll - not your IP adress.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!