Ok il give u a simple anti syi i made had some help with it Cerdits- [trey from runelocus]
this simple tutorial will only allow 1 connection per ip adress to prevent multi logging, syi, and other forms of socket flooding.
this simply adds connections to an arraylist and then checks to see if there is already a connection on the list before allowing the player to connect.
first, in the Server class, add these imports:
Code:
import java.util.List;
import java.util.ArrayList;
that or you can remove all of your utility imports and just add this:
Code:
import java.util.*;
next, declare a new arraylist:
Code:
public static List connected = new ArrayList();
now, search for:
and replace 'true' with:
Code:
if (!connected.contains(connectingHost))
this checks the list to see if there is already a connection from that host.
now everywhere in your run method that you see "connection from" add this line under it:
Code:
connections.add(connectingHost);
next, open the Client class, and search for your destruct method:
Code:
public void destruct
and under where you see something like "clienthandler (hostname) disconnected" under it add this line:
Code:
server.connected.remove(mySock.getInetAddress().getHostName());
and that should take care of it.
BE SURE YOUR FOLLOWING THE TUTORIAL CORRECTLY, NOT DOING SO COULD RESULT IN THE SERVER REJECTING CONNECTIONS WHEN IT SHOULDNT.
enjoy, any errors or problems just post em.