jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
changeset 14014 da3648e13e67
parent 13999 f6a2ce6a3e40
child 16870 f35b2bd19761
equal deleted inserted replaced
14013:10f55dd791e1 14014:da3648e13e67
    97         throws SocketException;
    97         throws SocketException;
    98 
    98 
    99     /**
    99     /**
   100      * Sends a datagram packet. The packet contains the data and the
   100      * Sends a datagram packet. The packet contains the data and the
   101      * destination address to send the packet to.
   101      * destination address to send the packet to.
   102      * @param packet to be sent.
   102      * @param p the packet to be sent.
   103      */
   103      */
   104     protected abstract void send(DatagramPacket p) throws IOException;
   104     protected abstract void send(DatagramPacket p) throws IOException;
   105 
   105 
   106     /**
   106     /**
   107      * Connects a datagram socket to a remote destination. This associates the remote
   107      * Connects a datagram socket to a remote destination. This associates the remote
   128         connectedPort = -1;
   128         connectedPort = -1;
   129     }
   129     }
   130 
   130 
   131     /**
   131     /**
   132      * Peek at the packet to see who it is from.
   132      * Peek at the packet to see who it is from.
   133      * @param return the address which the packet came from.
   133      * @param i the address to populate with the sender address
   134      */
   134      */
   135     protected abstract int peek(InetAddress i) throws IOException;
   135     protected abstract int peek(InetAddress i) throws IOException;
   136     protected abstract int peekData(DatagramPacket p) throws IOException;
   136     protected abstract int peekData(DatagramPacket p) throws IOException;
   137     /**
   137     /**
   138      * Receive the datagram packet.
   138      * Receive the datagram packet.
   139      * @param Packet Received.
   139      * @param p the packet to receive into
   140      */
   140      */
   141     protected synchronized void receive(DatagramPacket p)
   141     protected synchronized void receive(DatagramPacket p)
   142         throws IOException {
   142         throws IOException {
   143         receive0(p);
   143         receive0(p);
   144     }
   144     }
   146     protected abstract void receive0(DatagramPacket p)
   146     protected abstract void receive0(DatagramPacket p)
   147         throws IOException;
   147         throws IOException;
   148 
   148 
   149     /**
   149     /**
   150      * Set the TTL (time-to-live) option.
   150      * Set the TTL (time-to-live) option.
   151      * @param TTL to be set.
   151      * @param ttl TTL to be set.
   152      */
   152      */
   153     protected abstract void setTimeToLive(int ttl) throws IOException;
   153     protected abstract void setTimeToLive(int ttl) throws IOException;
   154 
   154 
   155     /**
   155     /**
   156      * Get the TTL (time-to-live) option.
   156      * Get the TTL (time-to-live) option.
   157      */
   157      */
   158     protected abstract int getTimeToLive() throws IOException;
   158     protected abstract int getTimeToLive() throws IOException;
   159 
   159 
   160     /**
   160     /**
   161      * Set the TTL (time-to-live) option.
   161      * Set the TTL (time-to-live) option.
   162      * @param TTL to be set.
   162      * @param ttl TTL to be set.
   163      */
   163      */
   164     @Deprecated
   164     @Deprecated
   165     protected abstract void setTTL(byte ttl) throws IOException;
   165     protected abstract void setTTL(byte ttl) throws IOException;
   166 
   166 
   167     /**
   167     /**
   170     @Deprecated
   170     @Deprecated
   171     protected abstract byte getTTL() throws IOException;
   171     protected abstract byte getTTL() throws IOException;
   172 
   172 
   173     /**
   173     /**
   174      * Join the multicast group.
   174      * Join the multicast group.
   175      * @param multicast address to join.
   175      * @param inetaddr multicast address to join.
   176      */
   176      */
   177     protected void join(InetAddress inetaddr) throws IOException {
   177     protected void join(InetAddress inetaddr) throws IOException {
   178         join(inetaddr, null);
   178         join(inetaddr, null);
   179     }
   179     }
   180 
   180 
   181     /**
   181     /**
   182      * Leave the multicast group.
   182      * Leave the multicast group.
   183      * @param multicast address to leave.
   183      * @param inetaddr multicast address to leave.
   184      */
   184      */
   185     protected void leave(InetAddress inetaddr) throws IOException {
   185     protected void leave(InetAddress inetaddr) throws IOException {
   186         leave(inetaddr, null);
   186         leave(inetaddr, null);
   187     }
   187     }
   188     /**
   188     /**
   189      * Join the multicast group.
   189      * Join the multicast group.
   190      * @param multicast address to join.
   190      * @param mcastaddr multicast address to join.
   191      * @param netIf specifies the local interface to receive multicast
   191      * @param netIf specifies the local interface to receive multicast
   192      *        datagram packets
   192      *        datagram packets
   193      * @throws  IllegalArgumentException if mcastaddr is null or is a
   193      * @throws  IllegalArgumentException if mcastaddr is null or is a
   194      *          SocketAddress subclass not supported by this socket
   194      *          SocketAddress subclass not supported by this socket
   195      * @since 1.4
   195      * @since 1.4
   205     protected abstract void join(InetAddress inetaddr, NetworkInterface netIf)
   205     protected abstract void join(InetAddress inetaddr, NetworkInterface netIf)
   206         throws IOException;
   206         throws IOException;
   207 
   207 
   208     /**
   208     /**
   209      * Leave the multicast group.
   209      * Leave the multicast group.
   210      * @param multicast address to leave.
   210      * @param mcastaddr  multicast address to leave.
   211      * @param netIf specified the local interface to leave the group at
   211      * @param netIf specified the local interface to leave the group at
   212      * @throws  IllegalArgumentException if mcastaddr is null or is a
   212      * @throws  IllegalArgumentException if mcastaddr is null or is a
   213      *          SocketAddress subclass not supported by this socket
   213      *          SocketAddress subclass not supported by this socket
   214      * @since 1.4
   214      * @since 1.4
   215      */
   215      */