Question: COMPUTER SCIENCE. These codes are for the client side and server side in Java Modify the following codes to improve functionality and allow the following:

COMPUTER SCIENCE.
These codes are for the client side and server side in Java
Modify the following codes to improve functionality and allow the following:
i. File streaming
ii. Utf
iii. Images/photos- I mean to allow sending and receiving images
iv. To accept files
*******************CHAT APPLICATION SOURCE CODE EXAMPLE******
File: MyServer.java
import java.io.*;
import java.net.*;
public class MyServer {
public static void main(String[] args){
try{
ServerSocket ss=new ServerSocket(6666);
Socket s=ss.accept();//establishes connection
DataInputStream dis=new DataInputStream(s.getInputStream());
String str=(String)dis.readUTF();
System.out.println("message="+str);
ss.close();
}catch(Exception e){System.out.println(e);}
}
}
--------------------------------------------------------------
File: MyClient.java
import java.io.*;
import java.net.*;
public class MyClient {
public static void main(String[] args){
try{
Socket s=new Socket("localhost",6666);
DataOutputStream dout=new DataOutputStream(s.getOutputStream());
dout.writeUTF("Hello Server");
dout.flush();
dout.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!