-
Notifications
You must be signed in to change notification settings - Fork 1
/
client1.java
37 lines (34 loc) · 971 Bytes
/
client1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.*;
import java.net.*;
public class client1 extends Thread
{
public static void main(String s[])
{
try
{
File f1=new File(s[0]);
FileInputStream fis=new FileInputStream(f1);
byte[] b=new byte[fis.available()];
Socket sc=new Socket("PC6",2222);
OutputStream os=sc.getOutputStream();
for(int i=0;i<b.length;i++)
{
b[i]=(byte)fis.read();
}
///FileOutputStream fout=new FileOutputStream("x.jpg");
// fout.write(b,0,b.length);
ByteArrayOutputStream bout= new ByteArrayOutputStream();
bout.write(b,0,b.length);
bout.writeTo(os);
///OutputStream os = sc.getOutputStream();
///PrintStream out =new PrintStream(os);
//out.println(data);
//out.flush();
// InputStream is =sc.getInputStream();
//BufferedReader br1 =new BufferedReader(new InputStreamReader(is));
//String da=br1.readLine().trim();
//System.out.println("response from server"+da);
}
catch(Exception e){e.printStackTrace();}
}
}