Advertisement
Josif_tepe

Untitled

Mar 31st, 2022
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. import java.io.*;
  2. import java.net.Socket;
  3. import java.util.Scanner;
  4. import java.util.concurrent.*;
  5.  
  6. public class Client {
  7.     public static void main(String[] args) {
  8.         Socket socket = null;
  9.         try {
  10.             System.out.println("Najaveni sme!");
  11.           socket = new Socket("localhost", 1234);
  12.             System.out.println("Napisi poraka: ");
  13.             BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
  14.             String poraka = userInput.readLine();
  15.             PrintWriter output = new PrintWriter(socket.getOutputStream(), true);
  16.             output.println(poraka);
  17.             BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  18. //            System.out.println(in.readLine());
  19.  
  20.         }
  21.         catch (IOException io) {
  22.             io.printStackTrace();
  23.         }
  24.  
  25.     }
  26.  
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement