mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-06-16 00:16:04 +00:00
2002-10-08 Michael Koch <konqueror@gmx.de>
* java/net/HttpURLConnection.java (getPermission): New method. (getErrorStream): New stub method. (getHeaderFieldDate): New stub method. * java/net/Inet4Address.java: (isLinkLocalAddress): Typo fixed. * java/net/InetAddress.java: (readResolve): New stubbed method (for serialization). (isAnyLocalAddress): New stubbed method. (isLoopbackAddress): New stubbed method. (isLinkLocalAddress): New stubbed method. (isSiteLocalAddress): New stubbed method. (isMCGlobal): New stubbed method. (isMCNodeGlobal): New stubbed method. (isMCLinkLocal): New stubbed method. (isMCSiteLocal): New stubbed method. (isMCOrgLocal): New stubbed method. (getCanonicalHostName): New stubbed method. (getByAddress): Create instances of Inet4Address/Inet6Address, instead of InetAddress, documentation added. * java/net/MulticastSocket.java (getInterface): Removed FIXME. (getNetworkInterface): New method. (setNetworkInterface): New method. * java/net/NetworkInterface.java: (toString): Use property "line.separator" instead of "\n". * java/net/URLConnection.java (getContent): New stubbed method. * java/net/URLStreamHandler.java: (equals): New stubbed method. (hostsEqual): New stubbed method. (hashCode): New stubbed method. * java/net/natNetworkInterface.cc: (getRealNetworkInterfaces): Create Inet4Address object instead of InetAddress. From-SVN: r58002
This commit is contained in:
committed by
Michael Koch
parent
402a402cab
commit
7393decb70
@@ -38,6 +38,7 @@ exception statement from your version. */
|
||||
package java.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||
@@ -120,7 +121,6 @@ public class MulticastSocket extends DatagramSocket
|
||||
*/
|
||||
public InetAddress getInterface() throws SocketException
|
||||
{
|
||||
// FIXME: Is it possible that an InetAddress wasn't returned from getOption?
|
||||
return (InetAddress) impl.getOption(SocketOptions.IP_MULTICAST_IF);
|
||||
}
|
||||
|
||||
@@ -172,6 +172,58 @@ public class MulticastSocket extends DatagramSocket
|
||||
impl.setOption(SocketOptions.IP_MULTICAST_IF, inf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the local network interface used to send multicast messages
|
||||
*
|
||||
* @param netIF The local network interface used to send multicast messages
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @see MulticastSocket:getNetworkInterface
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setNetworkInterface(NetworkInterface netIf)
|
||||
throws SocketException
|
||||
{
|
||||
if (impl == null)
|
||||
throw new SocketException (
|
||||
"MulticastSocket: Cant access socket implementation");
|
||||
|
||||
Enumeration e = netIf.getInetAddresses ();
|
||||
|
||||
if (!e.hasMoreElements ())
|
||||
throw new SocketException ("MulticastSocket: Error");
|
||||
|
||||
InetAddress address = (InetAddress) e.nextElement ();
|
||||
impl.setOption (SocketOptions.IP_MULTICAST_IF, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the local network interface which is used to send multicast messages
|
||||
*
|
||||
* @return The local network interface to send multicast messages
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @see MulticastSocket:setNetworkInterface
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public NetworkInterface getNetworkInterface()
|
||||
throws SocketException
|
||||
{
|
||||
if (impl == null)
|
||||
throw new SocketException (
|
||||
"MulticastSocket: Cant access socket implementation");
|
||||
|
||||
InetAddress address =
|
||||
(InetAddress) impl.getOption (SocketOptions.IP_MULTICAST_IF);
|
||||
NetworkInterface netIf = NetworkInterface.getByInetAddress (address);
|
||||
|
||||
return netIf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable/Enable local loopback of multicast packets. The option is used by
|
||||
* the platform's networking code as a hint for setting whether multicast
|
||||
@@ -188,6 +240,10 @@ public class MulticastSocket extends DatagramSocket
|
||||
*/
|
||||
public void setLoopbackMode(boolean disable) throws SocketException
|
||||
{
|
||||
if (impl == null)
|
||||
throw new SocketException (
|
||||
"MulticastSocket: Cant access socket implementation");
|
||||
|
||||
impl.setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user