private static String randomnick(final int n) { char[] array = new char[n]; int rand; Random r = new Random(); for (int i = 0; i< n; i++) { rand = r.nextInt(26) + 'a'; array[i] = (char)rand; } return new String(array); }
private static void connect(final String ip, final Integer port) throws IOException { socket = new Socket(ip, port); is = socket.getInputStream(); os = socket.getOutputStream(); }
public class Main {
private static InputStream is = null;
private static OutputStream os = null;
private static Socket socket = null;
public static ArrayList names = new ArrayList();
public static void main(final String[] args) throws IOException {
while(true){
connect("127.0.0.1", 12345);
disconnect();
}
}
private static String randomnick(final int n) {
char[] array = new char[n];
int rand;
Random r = new Random();
for (int i = 0; i< n; i++) {
rand = r.nextInt(26) + 'a';
array[i] = (char)rand;
}
return new String(array);
}
private static void connect(final String ip, final Integer port) throws IOException {
socket = new Socket(ip, port);
is = socket.getInputStream();
os = socket.getOutputStream();
}
private static void disconnect() throws IOException {
socket.close();
}