Please explain this code

public String getUserID(String usernmae, String password) {
        String flag = "";
        try {
            if (true) {
                socket = new Socket("localhost", 1111);
                dos = new DataOutputStream(socket.getOutputStream());
                dos.writeUTF("SignIn");
                dos.writeUTF(username);
                dos.writeUTF(password);
                dis = new DataInputStream(socket.getInputStream());
                response = dis.readUTF();
                String[] res_arr = response.split("#");
                if (res_arr[0].equalsIgnoreCase("record")) {
                    flag = "success";
                    userid = Integer.parseInt(res_arr[1]);
                    port = Integer.parseInt(res_arr[2]);
                    secretkey = res_arr[3];
                } else {
                    flag = "failure";
                        }
                      }
            }
} 

Replies

  • avii
    avii
    Looks like Java to me, is it? Waht problem you are trying to solve? how about providing some context instead of just copy-pasta

You are reading an archived discussion.

Related Posts

Currently, Indian smartphone market is flooded with tablets and phones from big brands to domestic vendors. Within 10 days, iBall has released a smartphone- iBall Andi 4.5T Cobalt2 and a...
Is RSA algorithm the best method for decifering information??
I had a dream of becoming a school teacher since my childhood.But after class 10th I decided to go for engineering. Now I think that was a immature decision due...
It's no secret that Amazon Phone is coming in June and the latest leaks in the media hint at awesomeness this phone would bring to the masses. Amazon was reported...
Samsung did announce earlier this year that it's working hard on a Quad-HD or QHD (we're talking of 2,560 x 1,440 pixel resolution here) AMOLED panel, it'll have to satisfy...