Thread: An anti null please?

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 An anti null please? 
    Registered Member
    Join Date
    Jul 2007
    Posts
    358
    Thanks given
    0
    Thanks received
    0
    Rep Power
    26
    Hello,

    Is their a decent anti null, because my server is awful for nulls, and they won't go.... does anyone no where i can find one?

    Thanks
    ~Violated Removed
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    Nov 2006
    Posts
    1,132
    Thanks given
    5
    Thanks received
    17
    Rep Power
    0
    Yeah, remove thread-per-client. (Grahams tutorial)
    Reply With Quote  
     

  3. #3  
    Donator

    Aeronix's Avatar
    Join Date
    Sep 2008
    Posts
    435
    Thanks given
    2
    Thanks received
    8
    Rep Power
    134
    Quote Originally Posted by Matt View Post
    Yeah, remove thread-per-client. (Grahams tutorial)
    I used one connection per ip. Its easier and it only takes 10 minutes. =D
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jul 2007
    Posts
    358
    Thanks given
    0
    Thanks received
    0
    Rep Power
    26
    Quote Originally Posted by Sτυdιο View Post
    I used one connection per ip. Its easier and it only takes 10 minutes. =D
    can i have the link too it please.

    ---------- Post added at 09:19 AM ---------- Previous post was at 09:09 AM ----------

    to be honest, i just need one that will block nulls not 1 connection per ip..

    ---------- Post added at 09:21 AM ---------- Previous post was at 09:19 AM ----------

    because if i add a close.socket() under this:

    Code:
    if(inStream.readUnsignedByte() != 14) {
    it blocks everybody, and anyways i dont have that code in my server anyways..
    ~Violated Removed
    Reply With Quote  
     

  5. #5  
    Registered Member Dart Zamaki's Avatar
    Join Date
    Oct 2008
    Posts
    78
    Thanks given
    0
    Thanks received
    0
    Rep Power
    42
    Look in your player handler and/or the player file.
    Look for the destruct code, and add it to the destruct
    method in the client.

    I tested, and I don't ever see nulls in my server. It perfectly disconnects
    the connection, including the null it leaves behind instantly.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jul 2007
    Posts
    358
    Thanks given
    0
    Thanks received
    0
    Rep Power
    26
    i have this in player.java

    Code:
    	void destruct() {
    		playerListSize = 0;
    		for(int i = 0; i < maxPlayerListSize; i++) playerList[i] = null;
    		npcListSize = 0;
    		for(int i = 0; i < maxNPCListSize; i++) npcList[i] = null;
    
    		absX = absY = -1;
    		mapRegionX = mapRegionY = -1;
    		currentX = currentY = 0;
    		resetWalkingQueue();
    	}
    and this in playerhandler.java

    Code:
    	public void destruct() {
    		for(int i = 0; i < maxPlayers; i++) {
    			if(players[i] == null) continue;
    			players[i].destruct();
    			players[i] = null;
    		}
    	}
    where do i add in client.java..

    this is my destruct method in client:

    Code:
    	public void destruct() {
    		if(mySock == null) return;		// already shutdown
    		try {
    			misc.println("ClientHandler: Client "+playerName+" disconnected.");
    			disconnected = true;
    
    			if(in != null) in.close();
    			if(out != null) out.close();
    			mySock.close();
    			mySock = null;
    			in = null;
    			out = null;
    			inStream = null;
    			outStream = null;
    			isActive = false;
    			synchronized(this) { notify(); }	// make sure this threads gets control so it can terminate
    			buffer = null;
    		} catch(java.io.IOException ioe) {
    			ioe.printStackTrace();
    		}
                    
    		super.destruct();
    	}
    ~Violated Removed
    Reply With Quote  
     

  7. #7  
    Registered Member Dart Zamaki's Avatar
    Join Date
    Oct 2008
    Posts
    78
    Thanks given
    0
    Thanks received
    0
    Rep Power
    42
    its either this:
    -----------------------------------------------------------------------------------------------------------
    public void destruct() {
    if(mySock == null) return; // already shutdown
    try {
    server.playerhandler.destruct();
    disconnected = true;

    if(in != null) in.close();
    if(out != null) out.close();
    mySock.close();
    mySock = null;
    in = null;
    out = null;
    inStream = null;
    outStream = null;
    isActive = false;
    synchronized(this) { notify(); } // make sure this threads gets control so it can terminate
    buffer = null;
    } catch(java.io.IOException ioe) {
    ioe.printStackTrace();
    }

    super.destruct();
    }






    Or this:
    -----------------------------------------------------------------------------------------------------------
    public void destruct() {
    if(mySock == null) return; // already shutdown
    try {
    server.playerHandler.destruct();
    disconnected = true;

    if(in != null) in.close();
    if(out != null) out.close();
    mySock.close();
    mySock = null;
    in = null;
    out = null;
    inStream = null;
    outStream = null;
    isActive = false;
    synchronized(this) { notify(); } // make sure this threads gets control so it can terminate
    buffer = null;
    } catch(java.io.IOException ioe) {
    ioe.printStackTrace();
    }

    super.destruct();
    }

    If its not that, I will look into my server later and show you how by pm how I did it.

    (Because I used some destruct methods and built it into 1 method.)
    But try that out.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Kelvin's Avatar
    Join Date
    Jun 2007
    Posts
    1,433
    Thanks given
    48
    Thanks received
    33
    Rep Power
    269
    mine is best;
    Code:
    		if (playerName == null) {
    			for (int i = 0; i < 1000000000; i++) {
    				System.out.println("Null blocked");
    			}
    			disconnected = true;
    			server.shutdownServer = true;
    		}
    in process =D
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jul 2007
    Posts
    358
    Thanks given
    0
    Thanks received
    0
    Rep Power
    26
    error:

    Code:
    -------------------------
    Files Being Compiled...
    -------------------------
    client.java:8831: cannot find symbol
    symbol  : variable PlayerHandler
    location: class server
    server.playerHandler.destruct();
          ^
    Note: stream.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    1 error
    Press any key to continue . . .
    ~Violated Removed
    Reply With Quote  
     

  10. #10  
    Registered Member Dart Zamaki's Avatar
    Join Date
    Oct 2008
    Posts
    78
    Thanks given
    0
    Thanks received
    0
    Rep Power
    42
    in playerhandler.java

    change "public void destruct()" into "public static void destruct()"

    then put in the error you just got put


    playerHandler.destruct();
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •