Package org.jnode.driver.net

Examples of org.jnode.driver.net.NetDeviceAPI


    public List<InetAddress> getInetAddresses(VMNetDevice netDevice) {
        final ArrayList<InetAddress> list = new ArrayList<InetAddress>();
        final SecurityManager sm = System.getSecurityManager();
        try {
            final NetDeviceImpl netDeviceImpl = (NetDeviceImpl) netDevice;
            final NetDeviceAPI api = netDeviceImpl.getDevice().getAPI(NetDeviceAPI.class);
            final ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
            if (info != null) {
                for (ProtocolAddress ipaddr : info.addresses()) {
                    if (sm != null) {
                        try {
                            sm.checkConnect(ipaddr.toString(), 58000);
View Full Code Here


     *                If the specified addess is null
     */
    public VMNetDevice getByInetAddress(InetAddress addr) throws SocketException {
        for (Device dev : DeviceUtils.getDevicesByAPI(NetDeviceAPI.class)) {
            try {
                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                final ProtocolAddressInfo info = api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
                if (info != null && info.contains(addr)) {
                    return new NetDeviceImpl(dev);
                }
            } catch (ApiNotFoundException ex) {
                // Ignore
View Full Code Here

    public InetAddress getLocalAddress() throws UnknownHostException {
        final Collection<Device> devices = DeviceUtils
                .getDevicesByAPI(NetDeviceAPI.class);
        for (Device dev : devices) {
            try {
                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                final ProtocolAddressInfo addrInfo =
                    api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
                if (addrInfo != null) {
                    final ProtocolAddress addr = addrInfo.getDefaultAddress();
                    if (addr != null) {
                        return addr.toInetAddress();
                    }
View Full Code Here

TOP

Related Classes of org.jnode.driver.net.NetDeviceAPI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.