Faab234
July 23rd, 2010, 08:31
This is my first tutorial for 562 server, so Maybe there are errors.
First we go to SocketManager and add this Import:
import java.util.ArrayList;
Now we Declare this:
private static ArrayList<String> connections = new ArrayList<String>();
Now we go to the addPendingConnections method, Under "String host = socket.socket().getInetAddress().getHostAddress();", we Add:
connections.add(host);
Above " socket.configureBlocking(false);", we add:
if (connections.contains(host)) {
socket.close();
continue;
}
If you allow more IP's, Declare:
private int limited = 0;
private int current = 0;
And change
if (connections.contains(host)) {
socket.close();
continue;
}
To
if (current == limited) {
if (connections.contains(host)) {
socket.close();
continue;
}
} else {
current++;
}
I don't tested it, so if you test Thanks. Post Errors.
First we go to SocketManager and add this Import:
import java.util.ArrayList;
Now we Declare this:
private static ArrayList<String> connections = new ArrayList<String>();
Now we go to the addPendingConnections method, Under "String host = socket.socket().getInetAddress().getHostAddress();", we Add:
connections.add(host);
Above " socket.configureBlocking(false);", we add:
if (connections.contains(host)) {
socket.close();
continue;
}
If you allow more IP's, Declare:
private int limited = 0;
private int current = 0;
And change
if (connections.contains(host)) {
socket.close();
continue;
}
To
if (current == limited) {
if (connections.contains(host)) {
socket.close();
continue;
}
} else {
current++;
}
I don't tested it, so if you test Thanks. Post Errors.