/// <summary> /// Get the IP address of our host. An empty host field or a DNS failure /// will result in a null return. /// </summary> /// <param name="u"> a URL object </param> /// <returns> an {@code InetAddress} representing the host /// IP address. /// @since 1.3 </returns> protected internal virtual InetAddress GetHostAddress(URL u) { lock (this) { if (u.HostAddress != null) { return(u.HostAddress); } String host = u.Host; if (host == null || host.Equals("")) { return(null); } else { try { u.HostAddress = InetAddress.GetByName(host); } catch (UnknownHostException) { return(null); } catch (SecurityException) { return(null); } } return(u.HostAddress); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected synchronized void bind0(int lport, InetAddress laddr) throws SocketException protected internal override void Bind0(int lport, InetAddress laddr) { lock (this) { bind0(lport, laddr, ExclusiveBind); } }
/// <summary> /// Creates a socket and connects it to the specified port on /// the specified host. </summary> /// <param name="host"> the specified host </param> /// <param name="port"> the specified port </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void connect(String host, int port) throws UnknownHostException, java.io.IOException protected internal override void Connect(String host, int port) { bool connected = false; try { InetAddress address = InetAddress.GetByName(host); this.Port_Renamed = port; this.Address = address; ConnectToAddress(address, port, Timeout_Renamed); connected = true; } finally { if (!connected) { try { Close(); } catch (IOException) { /* Do nothing. If connect threw an exception then * it will be passed up the call stack */ } } } }
/// <summary> /// Get the default time-to-live for multicast packets sent out on /// the socket. /// </summary> /// <exception cref="IOException"> if an I/O exception occurs /// while getting the default time-to-live value </exception> /// <returns> the default time-to-live value </returns> /// @deprecated use the getTimeToLive method instead, which returns /// an <b>int</b> instead of a <b>byte</b>. /// <seealso cref= #setTTL(byte) </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Deprecated("use the getTimeToLive method instead, which returns") public byte getTTL() throws java.io.IOException /// <summary> /// Joins a multicast group. Its behavior may be affected by /// {@code setInterface} or {@code setNetworkInterface}. /// /// <para>If there is a security manager, this method first /// calls its {@code checkMulticast} method /// with the {@code mcastaddr} argument /// as its argument. /// /// </para> /// </summary> /// <param name="mcastaddr"> is the multicast address to join /// </param> /// <exception cref="IOException"> if there is an error joining /// or when the address is not a multicast address. </exception> /// <exception cref="SecurityException"> if a security manager exists and its /// {@code checkMulticast} method doesn't allow the join. /// </exception> /// <seealso cref= SecurityManager#checkMulticast(InetAddress) </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void joinGroup(InetAddress mcastaddr) throws java.io.IOException public virtual void JoinGroup(InetAddress mcastaddr) { if (Closed) { throw new SocketException("Socket is closed"); } CheckAddress(mcastaddr, "joinGroup"); SecurityManager security = System.SecurityManager; if (security != null) { security.CheckMulticast(mcastaddr); } if (!mcastaddr.MulticastAddress) { throw new SocketException("Not a multicast address"); } /// <summary> /// required for some platforms where it's not possible to join /// a group without setting the interface first. /// </summary> NetworkInterface defaultInterface = NetworkInterface.Default; if (!InterfaceSet && defaultInterface != null) { NetworkInterface = defaultInterface; } Impl.Join(mcastaddr); }
/// <summary> /// Create a server with the specified port, listen backlog, and /// local IP address to bind to. The <i>bindAddr</i> argument /// can be used on a multi-homed host for a ServerSocket that /// will only accept connect requests to one of its addresses. /// If <i>bindAddr</i> is null, it will default accepting /// connections on any/all local addresses. /// The port must be between 0 and 65535, inclusive. /// A port number of {@code 0} means that the port number is /// automatically allocated, typically from an ephemeral port range. /// This port number can then be retrieved by calling /// <seealso cref="#getLocalPort getLocalPort"/>. /// /// <P>If there is a security manager, this method /// calls its {@code checkListen} method /// with the {@code port} argument /// as its argument to ensure the operation is allowed. /// This could result in a SecurityException. /// /// The {@code backlog} argument is the requested maximum number of /// pending connections on the socket. Its exact semantics are implementation /// specific. In particular, an implementation may impose a maximum length /// or may choose to ignore the parameter altogther. The value provided /// should be greater than {@code 0}. If it is less than or equal to /// {@code 0}, then an implementation specific default will be used. /// <P> </summary> /// <param name="port"> the port number, or {@code 0} to use a port /// number that is automatically allocated. </param> /// <param name="backlog"> requested maximum length of the queue of incoming /// connections. </param> /// <param name="bindAddr"> the local InetAddress the server will bind to /// </param> /// <exception cref="SecurityException"> if a security manager exists and /// its {@code checkListen} method doesn't allow the operation. /// </exception> /// <exception cref="IOException"> if an I/O error occurs when opening the socket. </exception> /// <exception cref="IllegalArgumentException"> if the port parameter is outside /// the specified range of valid port values, which is between /// 0 and 65535, inclusive. /// </exception> /// <seealso cref= SocketOptions </seealso> /// <seealso cref= SocketImpl </seealso> /// <seealso cref= SecurityManager#checkListen /// @since JDK1.1 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public ServerSocket(int port, int backlog, InetAddress bindAddr) throws java.io.IOException public ServerSocket(int port, int backlog, InetAddress bindAddr) { SetImpl(); if (port < 0 || port > 0xFFFF) { throw new IllegalArgumentException("Port value out of range: " + port); } if (backlog < 1) { backlog = 50; } try { Bind(new InetSocketAddress(bindAddr, port), backlog); } catch (SecurityException e) { Close(); throw e; } catch (IOException e) { Close(); throw e; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected synchronized void bind(InetAddress address, int lport) throws IOException protected internal override void Bind(InetAddress address, int lport) { lock (this) { Impl.Bind(address, lport); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException internal override void DoConnect(InetAddress address, int port, int timeout) { lock (this) { Impl.DoConnect(address, port, timeout); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException private void ReadObject(ObjectInputStream @in) { // Don't call defaultReadObject() ObjectInputStream.GetField oisFields = @in.ReadFields(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String oisHostname = (String)oisFields.get("hostname", null); String oisHostname = (String)oisFields.Get("hostname", null); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final InetAddress oisAddr = (InetAddress)oisFields.get("addr", null); InetAddress oisAddr = (InetAddress)oisFields.Get("addr", null); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int oisPort = oisFields.get("port", -1); int oisPort = oisFields.Get("port", -1); // Check that our invariants are satisfied CheckPort(oisPort); if (oisHostname == null && oisAddr == null) { throw new InvalidObjectException("hostname and addr " + "can't both be null"); } InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname, oisAddr, oisPort); UNSAFE.putObject(this, FIELDS_OFFSET, h); }
public static int connect0(FileDescriptor fd, bool preferIPv6, InetAddress remote, int remotePort, object handler) { #if FIRST_PASS return(0); #else return(new Connect().Do(fd.getSocket(), new System.Net.IPEndPoint(java.net.SocketUtil.getAddressFromInetAddress(remote, preferIPv6), remotePort), handler)); #endif }
/// <summary> /// Provides the default hash calculation. May be overidden by handlers for /// other protocols that have different requirements for hashCode /// calculation. </summary> /// <param name="u"> a URL object </param> /// <returns> an {@code int} suitable for hash table indexing /// @since 1.3 </returns> protected internal virtual int HashCode(URL u) { int h = 0; // Generate the protocol part. String protocol = u.Protocol; if (protocol != null) { h += protocol.HashCode(); } // Generate the host part. InetAddress addr = GetHostAddress(u); if (addr != null) { h += addr.HashCode(); } else { String host = u.Host; if (host != null) { h += host.ToLowerCase().HashCode(); } } // Generate the file part. String file = u.File; if (file != null) { h += file.HashCode(); } // Generate the port part. if (u.Port == -1) { h += DefaultPort; } else { h += u.Port; } // Generate the ref part. String @ref = u.Ref; if (@ref != null) { h += @ref.HashCode(); } return(h); }
/// <summary> /// Binds the socket to the specified address of the specified local port. </summary> /// <param name="address"> the address </param> /// <param name="port"> the port </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected synchronized void bind(InetAddress address, int lport) throws java.io.IOException protected internal override void Bind(InetAddress address, int lport) { lock (this) { base.Bind(address, lport); if (address.AnyLocalAddress) { AnyLocalBoundAddr = address; } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected synchronized void bind(int lport, InetAddress laddr) throws SocketException protected internal override void Bind(int lport, InetAddress laddr) { lock (this) { base.Bind(lport, laddr); if (laddr.AnyLocalAddress) { AnyLocalBoundAddr = laddr; } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void connect0(InetAddress address, int port) throws SocketException protected internal override void Connect0(InetAddress address, int port) { int nativefd = CheckAndReturnNativeFD(); if (address == null) { throw new NullPointerException("address"); } socketConnect(nativefd, address, port); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void connectToAddress(InetAddress address, int port, int timeout) throws java.io.IOException private void ConnectToAddress(InetAddress address, int port, int timeout) { if (address.AnyLocalAddress) { DoConnect(InetAddress.LocalHost, port, timeout); } else { DoConnect(address, port, timeout); } }
/// <summary> /// Convenience method to search for a network interface that /// has the specified Internet Protocol (IP) address bound to /// it. /// <para> /// If the specified IP address is bound to multiple network /// interfaces it is not defined which network interface is /// returned. /// /// </para> /// </summary> /// <param name="addr"> /// The {@code InetAddress} to search with. /// </param> /// <returns> A {@code NetworkInterface} /// or {@code null} if there is no network interface /// with the specified IP address. /// </returns> /// <exception cref="SocketException"> /// If an I/O error occurs. /// </exception> /// <exception cref="NullPointerException"> /// If the specified address is {@code null}. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException public static NetworkInterface GetByInetAddress(InetAddress addr) { if (addr == null) { throw new NullPointerException(); } if (!(addr is Inet4Address || addr is Inet6Address)) { throw new IllegalArgumentException("invalid address type"); } return(getByInetAddress0(addr)); }
public NetworkListenThread(MinecraftServer minecraftserver, InetAddress inetaddress, int i) { field_973_b = false; field_977_f = 0; pendingConnections = new ArrayList(); playerList = new ArrayList(); mcServer = minecraftserver; serverSocket = new ServerSocket(i, 0, inetaddress); serverSocket.setPerformancePreferences(0, 2, 1); field_973_b = true; networkAcceptThread = new NetworkAcceptThread(this, "Listen thread", minecraftserver); networkAcceptThread.start(); }
/// /// <summary> /// Creates a socket address from a hostname and a port number. /// <para> /// An attempt will be made to resolve the hostname into an InetAddress. /// If that attempt fails, the address will be flagged as <I>unresolved</I>. /// </para> /// <para> /// If there is a security manager, its {@code checkConnect} method /// is called with the host name as its argument to check the permission /// to resolve it. This could result in a SecurityException. /// <P> /// A valid port value is between 0 and 65535. /// A port number of {@code zero} will let the system pick up an /// ephemeral port in a {@code bind} operation. /// <P> /// </para> /// </summary> /// <param name="hostname"> the Host name </param> /// <param name="port"> The port number </param> /// <exception cref="IllegalArgumentException"> if the port parameter is outside the range /// of valid port values, or if the hostname parameter is <TT>null</TT>. </exception> /// <exception cref="SecurityException"> if a security manager is present and /// permission to resolve the host name is /// denied. </exception> /// <seealso cref= #isUnresolved() </seealso> public InetSocketAddress(String hostname, int port) { CheckHost(hostname); InetAddress addr = null; String host = null; try { addr = InetAddress.GetByName(hostname); } catch (UnknownHostException) { host = hostname; } Holder = new InetSocketAddressHolder(host, addr, CheckPort(port)); }
/// <summary> /// The workhorse of the connection operation. Tries several times to /// establish a connection to the given <host, port>. If unsuccessful, /// throws an IOException indicating what went wrong. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: synchronized void doConnect(InetAddress address, int port, int timeout) throws java.io.IOException internal virtual void DoConnect(InetAddress address, int port, int timeout) { lock (this) { lock (FdLock) { if (!ClosePending && (Socket_Renamed == null || !Socket_Renamed.Bound)) { NetHooks.beforeTcpConnect(Fd, address, port); } } try { AcquireFD(); try { SocketConnect(address, port, timeout); /* socket may have been closed during poll/select */ lock (FdLock) { if (ClosePending) { throw new SocketException("Socket closed"); } } // If we have a ref. to the Socket, then sets the flags // created, bound & connected to true. // This is normally done in Socket.connect() but some // subclasses of Socket may call impl.connect() directly! if (Socket_Renamed != null) { Socket_Renamed.SetBound(); Socket_Renamed.SetConnected(); } } finally { ReleaseFD(); } } catch (IOException e) { Close(); throw e; } } }
/// <summary> /// Creates a socket and connects it to the specified address on /// the specified port. </summary> /// <param name="address"> the address </param> /// <param name="port"> the specified port </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void connect(InetAddress address, int port) throws java.io.IOException protected internal override void Connect(InetAddress address, int port) { this.Port_Renamed = port; this.Address = address; try { ConnectToAddress(address, port, Timeout_Renamed); return; } catch (IOException e) { // everything failed Close(); throw e; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected synchronized int peek(InetAddress address) throws java.io.IOException protected internal override int Peek(InetAddress address) { lock (this) { int nativefd = CheckAndReturnNativeFD(); if (address == null) { throw new NullPointerException("Null address in peek()"); } // Use peekData() DatagramPacket peekPacket = new DatagramPacket(new sbyte[1], 1); int peekPort = PeekData(peekPacket); address = peekPacket.Address; return(peekPort); } }
/// <summary> /// Replaces the object to be serialized with an InetAddress object. /// </summary> /// <returns> the alternate object to be serialized. /// </returns> /// <exception cref="ObjectStreamException"> if a new object replacing this /// object could not be created </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private Object writeReplace() throws java.io.ObjectStreamException private Object WriteReplace() { // will replace the to be serialized 'this' object InetAddress inet = new InetAddress(); inet.Holder().HostName_Renamed = Holder().HostName; inet.Holder().Address_Renamed = Holder().Address; /// <summary> /// Prior to 1.4 an InetAddress was created with a family /// based on the platform AF_INET value (usually 2). /// For compatibility reasons we must therefore write the /// the InetAddress with this family. /// </summary> inet.Holder().Family_Renamed = 2; return(inet); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean isReachable(InetAddress addr, int timeout, NetworkInterface netif, int ttl) throws java.io.IOException public virtual bool IsReachable(InetAddress addr, int timeout, NetworkInterface netif, int ttl) { sbyte[] ifaddr = null; int scope = -1; int netif_scope = -1; if (netif != null) { /* * Let's make sure we bind to an address of the proper family. * Which means same family as addr because at this point it could * be either an IPv6 address or an IPv4 address (case of a dual * stack system). */ IEnumerator <InetAddress> it = netif.InetAddresses; InetAddress inetaddr = null; while (it.MoveNext()) { inetaddr = it.Current; if (inetaddr.GetType().IsInstanceOfType(addr)) { ifaddr = inetaddr.Address; if (inetaddr is Inet6Address) { netif_scope = ((Inet6Address)inetaddr).ScopeId; } break; } } if (ifaddr == null) { // Interface doesn't support the address family of // the destination return(false); } } if (addr is Inet6Address) { scope = ((Inet6Address)addr).ScopeId; } return(isReachable0(addr.Address, scope, timeout, ifaddr, ttl, netif_scope)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void socketConnect(InetAddress address, int port, int timeout) throws java.io.IOException internal override void SocketConnect(InetAddress address, int port, int timeout) { int nativefd = CheckAndReturnNativeFD(); if (address == null) { throw new NullPointerException("inet address argument is null."); } int connectResult; if (timeout <= 0) { connectResult = connect0(nativefd, address, port); } else { configureBlocking(nativefd, false); try { connectResult = connect0(nativefd, address, port); if (connectResult == WOULDBLOCK) { waitForConnect(nativefd, timeout); } } finally { configureBlocking(nativefd, true); } } /* * We need to set the local port field. If bind was called * previous to the connect (by the client) then localport field * will already be set. */ if (Localport == 0) { Localport = localPort0(nativefd); } }
/// <summary> /// Compares the host components of two URLs. </summary> /// <param name="u1"> the URL of the first host to compare </param> /// <param name="u2"> the URL of the second host to compare </param> /// <returns> {@code true} if and only if they /// are equal, {@code false} otherwise. /// @since 1.3 </returns> protected internal virtual bool HostsEqual(URL u1, URL u2) { InetAddress a1 = GetHostAddress(u1); InetAddress a2 = GetHostAddress(u2); // if we have internet address for both, compare them if (a1 != null && a2 != null) { return(a1.Equals(a2)); // else, if both have host names, compare them } else if (u1.Host != null && u2.Host != null) { return(u1.Host.EqualsIgnoreCase(u2.Host)); } else { return(u1.Host == null && u2.Host == null); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void socketBind(InetAddress address, int port) throws java.io.IOException internal override void SocketBind(InetAddress address, int port) { int nativefd = CheckAndReturnNativeFD(); if (address == null) { throw new NullPointerException("inet address argument is null."); } bind0(nativefd, address, port, ExclusiveBind); if (port == 0) { Localport = localPort0(nativefd); } else { Localport = port; } this.Address = address; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean isReachable(InetAddress addr, int timeout, NetworkInterface netif, int ttl) throws java.io.IOException public virtual bool IsReachable(InetAddress addr, int timeout, NetworkInterface netif, int ttl) { sbyte[] ifaddr = null; if (netif != null) { /* * Let's make sure we use an address of the proper family */ IEnumerator <InetAddress> it = netif.InetAddresses; InetAddress inetaddr = null; while (!(inetaddr is Inet4Address) && it.MoveNext()) { inetaddr = it.Current; } if (inetaddr is Inet4Address) { ifaddr = inetaddr.Address; } } return(isReachable0(addr.Address, timeout, ifaddr, ttl)); }
public static object lookupAllHostAddr(object thisInet6AddressImpl, string hostname) { #if FIRST_PASS return(null); #else try { IPAddress[] addr = Dns.GetHostAddresses(hostname); java.net.InetAddress[] addresses = new java.net.InetAddress[addr.Length]; int pos = 0; for (int i = 0; i < addr.Length; i++) { if (addr[i].AddressFamily == AddressFamily.InterNetworkV6 == java.net.InetAddress.preferIPv6Address) { addresses[pos++] = Java_java_net_InetAddress.ConvertIPAddress(addr[i], hostname); } } for (int i = 0; i < addr.Length; i++) { if (addr[i].AddressFamily == AddressFamily.InterNetworkV6 != java.net.InetAddress.preferIPv6Address) { addresses[pos++] = Java_java_net_InetAddress.ConvertIPAddress(addr[i], hostname); } } if (addresses.Length == 0) { throw new java.net.UnknownHostException(hostname); } return(addresses); } catch (ArgumentException x) { throw new java.net.UnknownHostException(x.Message); } catch (SocketException x) { throw new java.net.UnknownHostException(x.Message); } #endif }
/// <summary> /// Leave a multicast group. Its behavior may be affected by /// {@code setInterface} or {@code setNetworkInterface}. /// /// <para>If there is a security manager, this method first /// calls its {@code checkMulticast} method /// with the {@code mcastaddr} argument /// as its argument. /// /// </para> /// </summary> /// <param name="mcastaddr"> is the multicast address to leave </param> /// <exception cref="IOException"> if there is an error leaving /// or when the address is not a multicast address. </exception> /// <exception cref="SecurityException"> if a security manager exists and its /// {@code checkMulticast} method doesn't allow the operation. /// </exception> /// <seealso cref= SecurityManager#checkMulticast(InetAddress) </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void leaveGroup(InetAddress mcastaddr) throws java.io.IOException public virtual void LeaveGroup(InetAddress mcastaddr) { if (Closed) { throw new SocketException("Socket is closed"); } CheckAddress(mcastaddr, "leaveGroup"); SecurityManager security = System.SecurityManager; if (security != null) { security.CheckMulticast(mcastaddr); } if (!mcastaddr.MulticastAddress) { throw new SocketException("Not a multicast address"); } Impl.Leave(mcastaddr); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected synchronized void bind0(int lport, InetAddress laddr) throws SocketException protected internal override void Bind0(int lport, InetAddress laddr) { lock (this) { int nativefd = CheckAndReturnNativeFD(); if (laddr == null) { throw new NullPointerException("argument address"); } socketBind(nativefd, laddr, lport, ExclusiveBind); if (lport == 0) { LocalPort_Renamed = socketLocalPort(nativefd); } else { LocalPort_Renamed = lport; } } }
/// <summary> /// Binds the socket to the specified address of the specified local port. </summary> /// <param name="address"> the address </param> /// <param name="lport"> the port </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected synchronized void bind(InetAddress address, int lport) throws java.io.IOException protected internal override void Bind(InetAddress address, int lport) { lock (this) { lock (FdLock) { if (!ClosePending && (Socket_Renamed == null || !Socket_Renamed.Bound)) { NetHooks.beforeTcpBind(Fd, address, lport); } } SocketBind(address, lport); if (Socket_Renamed != null) { Socket_Renamed.SetBound(); } if (ServerSocket_Renamed != null) { ServerSocket_Renamed.SetBound(); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static int deriveNumericScope(byte[] thisAddr, NetworkInterface ifc) throws UnknownHostException private static int DeriveNumericScope(sbyte[] thisAddr, NetworkInterface ifc) { IEnumerator <InetAddress> addresses = ifc.InetAddresses; while (addresses.MoveNext()) { InetAddress addr = addresses.Current; if (!(addr is Inet6Address)) { continue; } Inet6Address ia6_addr = (Inet6Address)addr; /* check if site or link local prefixes match */ if (!IsDifferentLocalAddressType(thisAddr, ia6_addr.Address)) { /* type not the same, so carry on searching */ continue; } /* found a matching address - return its scope_id */ return(ia6_addr.ScopeId); } throw new UnknownHostException("no scope_id found"); }
public abstract ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress);
public void setAddress(InetAddress value) { throw null; }
public DatagramPacket(sbyte[] arg0, int arg1, int arg2, InetAddress arg3, int arg4) { throw null; }
public static object lookupAllHostAddr(object thisInet6AddressImpl, string hostname) { #if FIRST_PASS return null; #else try { IPAddress[] addr = Dns.GetHostAddresses(hostname); java.net.InetAddress[] addresses = new java.net.InetAddress[addr.Length]; int pos = 0; for (int i = 0; i < addr.Length; i++) { if (addr[i].AddressFamily == AddressFamily.InterNetworkV6 == java.net.InetAddress.preferIPv6Address) { addresses[pos++] = Java_java_net_InetAddress.ConvertIPAddress(addr[i], hostname); } } for (int i = 0; i < addr.Length; i++) { if (addr[i].AddressFamily == AddressFamily.InterNetworkV6 != java.net.InetAddress.preferIPv6Address) { addresses[pos++] = Java_java_net_InetAddress.ConvertIPAddress(addr[i], hostname); } } if (addresses.Length == 0) { throw new java.net.UnknownHostException(hostname); } return addresses; } catch (ArgumentException x) { throw new java.net.UnknownHostException(x.Message); } catch (SocketException x) { throw new java.net.UnknownHostException(x.Message); } #endif }
/// <summary> /// Creates a socket address from an IP address and a port number. /// </summary> public InetSocketAddress(InetAddress @addr, int @port) { }
/// <summary> /// Convenience method to search for a network interface that /// has the specified Internet Protocol (IP) address bound to /// it. /// </summary> static public NetworkInterface getByInetAddress(InetAddress @addr) { return default(NetworkInterface); }
/// <summary> /// Create a server with the specified port, listen backlog, and /// local IP address to bind to. /// </summary> public ServerSocket(int @port, int @backlog, InetAddress @bindAddr) { }
public virtual void joinGroup(InetAddress value) { throw null; }
public virtual void leaveGroup(InetAddress value) { throw null; }
public virtual void setInterface(InetAddress value) { throw null; }