forked from tishrof/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
22 lines (22 loc) · 743 Bytes
/
Server.java
File metadata and controls
22 lines (22 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.net.*;
import java.io.*;
public class Server
{
public static void main (String[] args)
{
try
{
ServerSocket ss = new ServerSocket(6000);
Socket s = ss.accept();
DataInputStream dis = new DataInputStream(s.getInputStream());
String k = dis.readUTF();
System.out.println("File Transferred");
FileOutputStream fos = new FileOutputStream("F:\\IIIT V BOOKS\\Distributed\\Lab3\\201951046.txt");
fos.write(k.getBytes());
}
catch (IOException ie)
{
ie.printStackTrace();
}
}
}