Question: Add to this code & apply in it, hashing for Confidentiality service or Username & password for Authentication service (JAVA code) server side class initializes

Add to this code & apply in it, hashing for Confidentiality service or Username & password for Authentication service (JAVA code)

server side class initializes socket, establishes connection with socket.accept method, read string and close the connection.

but this code Doesn't it implement authentication and confidentiality services, so you should ADD IT in this codes below

Server class

import java.net.*;

import java.io.*; public class TestServer { public static void main(String[] args){ try{ ServerSocket ss=new ServerSocket(8088); Socket s=ss.accept(); DataInputStream DataInput=new DataInputStream(s.getInputStream()); String str=(String)DataInput.readUTF(); System.out.println("message= "+str); ss.close(); }catch(Exception e){System.out.println(e);} } }

client class

import java.io.*; import java.net.*; public class TestClient { public static void main(String[] args) { try{ Socket s=new Socket("localhost",8088); DataOutputStream output=new DataOutputStream(s.getOutputStream()); output.writeUTF("Hello Server! How are you doing?"); output.flush(); output.close(); s.close(); }catch(Exception e){System.out.println(e);} } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!