0

Что есть по этой теме?

2
  • нашел jNetPcap ( оболочка для pcap) на сайте у него сказано что только win/linux, а мне надо под mac os
    – Pavel
    30 янв 2012 в 12:44
  • jPcap сейчас попытался заюзать - не выходит..
    – Pavel
    30 янв 2012 в 13:15

1 ответ 1

3

Copy-paste из Java туториалов

import java.io.*;
import java.net.*;
import java.util.*;
import static java.lang.System.out;

public class ListNets 
{
    public static void main(String args[]) throws SocketException {
        Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
        for (NetworkInterface netint : Collections.list(nets))
            displayInterfaceInformation(netint);
    }

    static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
        out.printf("Display name: %s\n", netint.getDisplayName());
        out.printf("Name: %s\n", netint.getName());
        Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
        for (InetAddress inetAddress : Collections.list(inetAddresses)) {
            out.printf("InetAddress: %s\n", inetAddress);
        }
        out.printf("\n");
     }
}
1
  • cпасибо - то что надо вроде)
    – Pavel
    30 янв 2012 в 13:36

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.