CrazyEngineers
  • PavanRam
    PavanRam

    MemberApr 11, 2014

    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
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • avii

    MemberApr 11, 2014

    Looks like Java to me, is it? Waht problem you are trying to solve? how about providing some context instead of just copy-pasta
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register