public TCPImageFetcher(int teamNumber)
 {
   base.\u002Ector();
   TCPImageFetcher tcpImageFetcher = this;
   this.m_sock = (Socket) null;
   this.m_sockistream = (InputStream) null;
   this.m_imgBuffer = (byte[]) null;
   this.m_maxImgBufferSize = 0;
   this.m_baistream = (ByteArrayInputStream) null;
   this.m_daistream = (DataInputStream) null;
   this.m_initialized = false;
   this.m_address = (byte[]) null;
   int num1 = (int) (sbyte) (teamNumber / 100);
   int num2 = teamNumber;
   int num3 = 100;
   int num4 = -1;
   int num5 = num3 != num4 ? (int) (sbyte) (num2 % num3) : 0;
   byte[] numArray = new byte[4];
   int index1 = 0;
   int num6 = 10;
   numArray[index1] = (byte) num6;
   int index2 = 1;
   int num7 = num1;
   numArray[index2] = (byte) num7;
   int index3 = 2;
   int num8 = num5;
   numArray[index3] = (byte) num8;
   int index4 = 3;
   int num9 = 2;
   numArray[index4] = (byte) num9;
   this.m_address = numArray;
 }
Example #2
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();
 }
 private void init()
 {
   this.m_sock = new Socket(InetAddress.getByAddress(this.m_address), 1180);
   this.m_sock.setSoTimeout(3000);
   this.m_sockistream = this.m_sock.getInputStream();
   this.m_daistream = new DataInputStream(this.m_sockistream);
   this.m_initialized = true;
 }
Example #4
0
 public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, string s)
 {
     finishedProcessing = false;
     loginTimer = 0;
     username = null;
     field_9004_h = null;
     serverId = "";
     mcServer = minecraftserver;
     netManager = new NetworkManager(socket, s, this);
     netManager.chunkDataSendCounter = 0;
 }
 public virtual string chooseServerAlias(string keyType, Principal[] issuers, Socket socket)
 {
     throw new System.NotImplementedException();
 }
		/// <summary>
		/// Subclasses of ServerSocket use this method to override accept()
		/// to return their own subclass of socket.
		/// </summary>
		protected void implAccept(Socket @s)
		{
		}
Example #7
0
 public void networkShutdown(string s, object[] aobj)
 {
     if (!m_isRunning)
     {
         return;
     }
     isTerminating = true;
     terminationReason = s;
     field_20176_t = aobj;
     (new NetworkMasterThread(this)).start();
     m_isRunning = false;
     try
     {
         socketInputStream.close();
         socketInputStream = null;
     }
     catch (Throwable)
     {
     }
     try
     {
         socketOutputStream.close();
         socketOutputStream = null;
     }
     catch (Throwable)
     {
     }
     try
     {
         networkSocket.close();
         networkSocket = null;
     }
     catch (Throwable)
     {
     }
 }
Example #8
0
 public SocketStream(Socket s)
   : base(s.getInputStream(), s.getOutputStream())
 {
   SocketStream socketStream = this;
   this.socket = s;
 }
 // android?
 // Z:\jsc.svn\examples\java\hybrid\ubuntu\UbuntuTCPMultiplex\Program.cs
 public abstract Socket createSocket(Socket s, string host, int port, bool autoClose);
            public void run()
            {
                try
                {

                    serversocket = new ServerSocket(port);
                    serversocket.setReuseAddress(true);

                    while (isRunning)
                    {

                        clientsocket = serversocket.accept();
                        input = new BufferedReader(new InputStreamReader(clientsocket.getInputStream(), "ISO-8859-2"));
                        output = clientsocket.getOutputStream();

                        string sAll = getStringFromInput(input);

                        var i0 = sAll.IndexOf(" ", 0);
                        var i1 = sAll.IndexOf(" ", i0 + 1);


                        var path = ((java.lang.String)(object)sAll).substring(i0, i1);

                        if (path.Length > 0)
                            path = ((java.lang.String)(object)path).substring(2, path.Length);

                        var asset = openFileFromAssets(path, mycontext);

                        if (asset != null)
                        {
                            send(asset);
                        }
                        else
                        {
                            #region firstpage
                            string firstpage = "<body>";

                            firstpage += "<link rel=\"stylesheet\" type=\"text/css\" ";
                            firstpage += "href=\"/foo.css\" />";

                            firstpage += "<h1>";
                            firstpage += path;
                            firstpage += "</h1>";

                            firstpage += "<pre>";
                            firstpage += sAll;
                            firstpage += "</pre>";

                            firstpage += "First page! jsc! <a href='/foo.htm'>Next</a>";
                            firstpage += "Other page! jsc! <a href='/bar.htm'>Other</a>";

                            var assets = mycontext.getResources().getAssets();

                            var collection = assets.list(path);

                            foreach (var item in collection)
                            {

                                firstpage += "<pre>";
                                firstpage += item;
                                firstpage += "</pre>";
                                firstpage += "<hr />";

                            }

                            firstpage += "</body>";

                            send(firstpage);
                            #endregion

                        }

                        input.close();
                        output.close();

                    }
                }
                catch
                {

                }
            }