Inheritance: java.lang.Object, java.io.Serializable
Exemple #1
0
 public NetworkManager(Socket socket, string s, NetHandler nethandler)
 {
     sendQueueLock = new object();
     m_isRunning = true;
     readPackets = Collections.synchronizedList(new ArrayList());
     dataPackets = Collections.synchronizedList(new ArrayList());
     chunkDataPackets = Collections.synchronizedList(new ArrayList());
     m_isServerTerminating = false;
     isTerminating = false;
     terminationReason = "";
     timeSinceLastRead = 0;
     sendQueueByteLength = 0;
     chunkDataSendCounter = 0;
     field_20175_w = 50;
     networkSocket = socket;
     remoteSocketAddress = socket.getRemoteSocketAddress();
     netHandler = nethandler;
     socket.setTrafficClass(24);
     socketInputStream = new DataInputStream(socket.getInputStream());
     socketOutputStream = new DataOutputStream(socket.getOutputStream());
     readThread = new NetworkReaderThread(this, (new StringBuilder()).append(s).append(" read thread").toString());
     writeThread = new NetworkWriterThread(this,
                                           (new StringBuilder()).append(s).append(" write thread").toString());
     readThread.start();
     writeThread.start();
 }
		/// <summary>
		/// Binds the <code>ServerSocket</code> to a specific address
		/// (IP address and port number).
		/// </summary>
		public void bind(SocketAddress @endpoint, int @backlog)
		{
		}
		/// <summary>
		/// Binds the <code>ServerSocket</code> to a specific address
		/// (IP address and port number).
		/// </summary>
		public void bind(SocketAddress @endpoint)
		{
		}
 public virtual void leaveGroup(SocketAddress arg0, NetworkInterface arg1) { throw null; }
 public MulticastSocket(SocketAddress value) { throw null; }
Exemple #6
0
    public static int receive0(object obj, FileDescriptor fd, byte[] buf, int pos, int len, bool connected)
    {
#if FIRST_PASS
        return(0);
#else
        sun.nio.ch.DatagramChannelImpl impl          = (sun.nio.ch.DatagramChannelImpl)obj;
        java.net.SocketAddress         remoteAddress = impl.remoteAddress();
        System.Net.EndPoint            remoteEP;
        if (fd.getSocket().AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
        {
            remoteEP = new System.Net.IPEndPoint(System.Net.IPAddress.IPv6Any, 0);
        }
        else
        {
            remoteEP = new System.Net.IPEndPoint(0, 0);
        }
        java.net.InetSocketAddress addr;
        int length;
        do
        {
            for (; ;)
            {
                try
                {
                    length = fd.getSocket().ReceiveFrom(buf, pos, len, System.Net.Sockets.SocketFlags.None, ref remoteEP);
                    break;
                }
                catch (System.Net.Sockets.SocketException x)
                {
                    if (x.ErrorCode == java.net.SocketUtil.WSAECONNRESET)
                    {
                        // A previous send failed (i.e. the remote host responded with a ICMP that the port is closed) and
                        // the winsock stack helpfully lets us know this, but we only care about this when we're connected,
                        // otherwise we'll simply retry the receive (note that we use SIO_UDP_CONNRESET to prevent these
                        // WSAECONNRESET exceptions, but when switching from connected to disconnected, some can slip through).
                        if (connected)
                        {
                            throw new java.net.PortUnreachableException();
                        }
                        continue;
                    }
                    if (x.ErrorCode == java.net.SocketUtil.WSAEMSGSIZE)
                    {
                        // The buffer size was too small for the packet, ReceiveFrom receives the part of the packet
                        // that fits in the buffer and then throws an exception, so we have to ignore the exception in this case.
                        length = len;
                        break;
                    }
                    if (x.ErrorCode == java.net.SocketUtil.WSAEWOULDBLOCK)
                    {
                        return(sun.nio.ch.IOStatus.UNAVAILABLE);
                    }
                    throw java.net.SocketUtil.convertSocketExceptionToIOException(x);
                }
                catch (ObjectDisposedException)
                {
                    throw new java.net.SocketException("Socket is closed");
                }
            }
            System.Net.IPEndPoint ep = (System.Net.IPEndPoint)remoteEP;
            addr = new java.net.InetSocketAddress(java.net.SocketUtil.getInetAddressFromIPEndPoint(ep), ep.Port);
        } while (remoteAddress != null && !addr.equals(remoteAddress));
        impl.sender = addr;
        return(length);
#endif
    }
 /// <summary>
 /// Connects this socket to the server with a specified timeout value.
 /// </summary>
 public void connect(SocketAddress endpoint, int timeout)
 {
 }
 /// <summary>
 /// Connects this socket to the server.
 /// </summary>
 public void connect(SocketAddress endpoint)
 {
 }
 public void setSocketAddress(SocketAddress value) { throw null; }
 public DatagramPacket(sbyte[] arg0, int arg1, int arg2, SocketAddress arg3) { throw null; }
        /// <summary>
        /// Leave the multicast group. </summary>
        /// <param name="mcastaddr"> address to leave. </param>
        /// <param name="netIf"> specified the local interface to leave the group at </param>
        /// <exception cref="IOException"> if an I/O exception occurs while leaving
        /// the multicast group
        /// @since 1.4 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected abstract void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws java.io.IOException;
        protected internal abstract void LeaveGroup(SocketAddress mcastaddr, NetworkInterface netIf);
Exemple #12
0
        ///
        /// <summary>
        /// Binds the {@code ServerSocket} to a specific address
        /// (IP address and port number).
        /// <para>
        /// If the address is {@code null}, then the system will pick up
        /// an ephemeral port and a valid local address to bind the socket.
        /// </para>
        /// <para>
        /// </para>
        /// </summary>
        /// <param name="endpoint">        The IP address and port number to bind to. </param>
        /// <exception cref="IOException"> if the bind operation fails, or if the socket
        ///                     is already bound. </exception>
        /// <exception cref="SecurityException">       if a {@code SecurityManager} is present and
        /// its {@code checkListen} method doesn't allow the operation. </exception>
        /// <exception cref="IllegalArgumentException"> if endpoint is a
        ///          SocketAddress subclass not supported by this socket
        /// @since 1.4 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void bind(SocketAddress endpoint) throws java.io.IOException
        public virtual void Bind(SocketAddress endpoint)
        {
            Bind(endpoint, 50);
        }