Examples of RawSocket


Examples of org.savarese.rocksaw.net.RawSocket

  public ICMPSharedPinger(int timeout) throws IOException {
    // we use two shared sockets, because it works more efficiently
    // OSs tend to copy all received ICMP packets to all open raw sockets,
    // so it is very bad to have a separate raw socket for each scanning thread
    sendingSocket = new RawSocket();
    sendingSocket.open(RawSocket.PF_INET, IPPacket.PROTOCOL_ICMP);
    receivingSocket = new RawSocket();
    receivingSocket.open(RawSocket.PF_INET, IPPacket.PROTOCOL_ICMP);
    this.timeout = timeout;

    try {
      sendingSocket.setSendTimeout(timeout);
View Full Code Here

Examples of org.savarese.rocksaw.net.RawSocket

  public ICMPPinger(int timeout) {
    this.timeout = timeout;   
  }

  private RawSocket createRawSocket() throws IOException {
    RawSocket socket = new RawSocket();
    socket.open(RawSocket.PF_INET, IPPacket.PROTOCOL_ICMP);

    try {
      socket.setSendTimeout(timeout);
      socket.setReceiveTimeout(timeout);
    }
    catch (java.net.SocketException se) {
      socket.setUseSelectTimeout(true);
      socket.setSendTimeout(timeout);
      socket.setReceiveTimeout(timeout);
    }
    return socket;
  }
View Full Code Here

Examples of org.savarese.rocksaw.net.RawSocket

   * @param subject address to ping
   * @param count number of pings to perform
   */
  public PingResult ping(ScanningSubject subject, int count) throws IOException {
    PingResult result = new PingResult(subject.getAddress());
    RawSocket socket = createRawSocket();
   
    try {
      // send a bunch of packets
      for (int i = 0; i < count && !Thread.currentThread().isInterrupted(); i++) {
        try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.