A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Code Examples of InetAddress


			    // We can use the new peekData() API
			    DatagramPacket peekPacket = new DatagramPacket(new byte[1], 1);
			    peekPort = getImpl().peekData(peekPacket);
			    peekAd = peekPacket.getAddress().getHostAddress();
			} else {
			    InetAddress adr = new InetAddress();
			    peekPort = getImpl().peek(adr);
			    peekAd = adr.getHostAddress();
			}
			try {
			    security.checkAccept(peekAd, peekPort);
			    // security check succeeded - so now break
			    // and recv the packet.
			    break;
			} catch (SecurityException se) {
			    // Throw away the offending packet by consuming
			    // it in a tmp buffer.
			    DatagramPacket tmp = new DatagramPacket(new byte[1], 1);
			    getImpl().receive(tmp);
			
			    // silently discard the offending packet
			    // and continue: unknown/malicious
			    // entities on nets should not make
			    // runtime throw security exception and
			    // disrupt the applet by sending random
			    // datagram packets.
			    continue;
			} 
		    } // end of while
		}
	    }
	    if (connectState == ST_CONNECTED_NO_IMPL) {
		// We have to do the filtering the old fashioned way since
		// the native impl doesn't support connect or the connect
		// via the impl failed.
		boolean stop = false;
		while (!stop) {
		    // peek at the packet to see who it is from.
		    InetAddress peekAddress = new InetAddress();
		    int peekPort = getImpl().peek(peekAddress);
		    if ((!connectedAddress.equals(peekAddress)) ||
			(connectedPort != peekPort)) {
			// throw the packet away and silently continue
			DatagramPacket tmp = new DatagramPacket(new byte[1], 1);

View Full Code Here


            else {
                s.impl.reset();
            }
	    si = s.impl;	    
	    s.impl = null;
	    si.address = new InetAddress();
	    si.fd = new FileDescriptor();
	    getImpl().accept(si);
 	    
	    SecurityManager security = System.getSecurityManager();
	    if (security != null) {

View Full Code Here


     * @throws ObjectStreamException if a new object replacing this
     * object could not be created
     */
    private Object writeReplace() throws ObjectStreamException {
	// will replace the to be serialized 'this' object
	InetAddress inet = new InetAddress();
	inet.hostName = this.hostName;
	inet.address = this.address;

	/**
	 * Prior to 1.4 an InetAddress was created with a family

View Full Code Here


                    byte[] addrBytes = addr.getAddress();
                    for (int i = 0; i < broadcast.length; i++) {
                        broadcast[i] = (byte) (addrBytes[i] | ~maskBytes[i]);
                    }                    
                }                
                cacheBroadcast = new InetAddress(broadcast);
            }
            return cacheBroadcast;
        }
        return null;
    }

View Full Code Here


    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    private Object writeReplace() throws ObjectStreamException {
        return new InetAddress(ipaddress, hostName);
    }
}

View Full Code Here

TOP

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

TOP