Yeah, remove thread-per-client. (Grahams tutorial)
|
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
Yeah, remove thread-per-client. (Grahams tutorial)
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:
it blocks everybody, and anyways i dont have that code in my server anyways..Code:if(inStream.readUnsignedByte() != 14) {
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.
i have this in player.java
and this in playerhandler.javaCode: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(); }
where do i add in client.java..Code:public void destruct() { for(int i = 0; i < maxPlayers; i++) { if(players[i] == null) continue; players[i].destruct(); players[i] = null; } }
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(); }
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.
mine is best;
in process =DCode:if (playerName == null) { for (int i = 0; i < 1000000000; i++) { System.out.println("Null blocked"); } disconnected = true; server.shutdownServer = true; }
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 . . .
in playerhandler.java
change "public void destruct()" into "public static void destruct()"
then put in the error you just got put
playerHandler.destruct();
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |