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.Socket;
- import java.net.UnknownHostException;
- public class Client {
- public static void main(String[] args) {
- try {
- System.out.println("Najaveni sme");
- Socket socket = new Socket("localhost", 4567);
- BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Napisi poraka: ");
- String poraka = userInput.readLine();
- PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
- out.println(poraka);
- BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- System.out.println(input.readLine());
- }
- catch (Exception e) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement