Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Client
- {
- Socket s;
- DataOutputStream dos;
- DataInputStream dis;
- int flag;
- public Client() throws IOException
- {
- try
- {
- s=new Socket("localhost",1);
- dos= new DataOutputStream(s.getOutputStream());
- dis= new DataInputStream(s.getInputStream());
- OutputStream outputStream = s.getOutputStream();
- //clientinfo();
- applications();
- //Systeminfo();
- //ScreenShots();
- }
- catch(Exception e)
- {
- System.out.println(e);
- }
- }
- public MyServer1() throws IOException
- {
- ss=new ServerSocket(1);
- s=ss.accept();
- dis= new DataInputStream(s.getInputStream());
- int flag=dis.readInt();
- switch(flag)
- {
- case 1:
- {
- clientnameip();
- break;
- }
- case 2:
- {
- processes();
- break;
- }
- public void processes()throws IOException
- {
- int count=dis.readInt();
- System.out.print(count);
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/zeeshan","root","sHaNi97426");
- Statement stmt=(Statement)conn.createStatement();
- for(int i=0;i<count;i++)
- {
- String app=dis.readUTF();
- String insert="INSERT INTO applications VALUES('"+app+"');";
- stmt.addBatch(insert);
- }
- stmt.executeBatch();
- }
- catch(Exception e)
- {
- System.out.println(e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement