DatagramSocket.java (laddr): Removed.
* java/net/DatagramSocket.java (laddr): Removed. (DatagramSocket): Removed attempts to get or set laddr if null. (getLocalAddress): Reimplemented per spec. * java/net/MulticastSocket.java (setTimeToLive): Throw exception when ttl is 0. (joinGroup): Throw NullPointerException if any argument is null. (leaveGroup): ditto. * java/net/PlainDatagramSocketImpl.java: Updated comments. * java/net/PlainSocketImpl.java (timeout): Added. (getInputStream): Added FIXME comment on how to support timeouts for TCP. * java/net/ServerSocket.java (ServerSocket): Added FIXME comment. * java/net/Socket.java: Added FIXME comments to identify conflicting specs between the JCL and JDK 1.2 documents. * java/net/natPlainDatagramSocketImpl.cc (bind): Use INADDR_ANY if host is null. Get localport value resolved by kernel if bind lport is 0. (receive): Implemented support for timeouts in UDP. (setOption): Implemented based on natPlainSocketImpl version. (getOption): ditto. * java/net/natPlainSocketImpl.cc (bind): Get localport value resolved by kernel if bind lport is 0. (connect): Get localport value resolved by kernel if bind wasn't done to set localport. (accept): Implemented support for timeouts for ServerSocket. (setOption): Save value for SO_TIMEOUT. (getOption): Return timeout for SO_TIMEOUT. From-SVN: r27230
This commit is contained in:
parent
930248932e
commit
07515641a5
9 changed files with 332 additions and 59 deletions
|
@ -76,7 +76,7 @@ public class MulticastSocket extends DatagramSocket
|
|||
// JDK1.2
|
||||
public void setTimeToLive(int ttl) throws IOException
|
||||
{
|
||||
if (ttl < 0 || ttl > 255)
|
||||
if (ttl <= 0 || ttl > 255)
|
||||
throw new IllegalArgumentException("Invalid ttl: " + ttl);
|
||||
|
||||
impl.setTimeToLive(ttl);
|
||||
|
@ -84,6 +84,10 @@ public class MulticastSocket extends DatagramSocket
|
|||
|
||||
public void joinGroup(InetAddress mcastaddr) throws IOException
|
||||
{
|
||||
// FIXME: We can't currently rely on NullPointerException being
|
||||
// thrown when we invoke a method on a null object.
|
||||
if (mcastaddr == null)
|
||||
throw new NullPointerException("Null address");
|
||||
if (! mcastaddr.isMulticastAddress())
|
||||
throw new IOException("Not a Multicast address");
|
||||
|
||||
|
@ -96,6 +100,10 @@ public class MulticastSocket extends DatagramSocket
|
|||
|
||||
public void leaveGroup(InetAddress mcastaddr) throws IOException
|
||||
{
|
||||
// FIXME: We can't currently rely on NullPointerException being
|
||||
// thrown when we invoke a method on a null object.
|
||||
if (mcastaddr == null)
|
||||
throw new NullPointerException("Null address");
|
||||
if (! mcastaddr.isMulticastAddress())
|
||||
throw new IOException("Not a Multicast address");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue