Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.io.PrintWriter;
- import java.net.ServerSocket;
- import java.net.Socket;
- public class Server {
- public static void main(String[] args) {
- try {
- System.out.println("Cekame klienti");
- ServerSocket serverSocket = new ServerSocket(4567);
- Socket socket = serverSocket.accept();
- System.out.println("konekcijata e uspesna");
- BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- String server_poraka = in.readLine();
- PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
- System.out.println("serverot vika: " + server_poraka);
- }
- catch (IOException io) {
- io.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement