Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.Socket;
- import java.util.Scanner;
- import java.util.concurrent.*;
- public class Client {
- public static void main(String[] args) {
- Socket socket = null;
- try {
- System.out.println("Najaveni sme!");
- socket = new Socket("localhost", 1234);
- System.out.println("Napisi poraka: ");
- BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
- String poraka = userInput.readLine();
- PrintWriter output = new PrintWriter(socket.getOutputStream(), true);
- output.println(poraka);
- BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- // System.out.println(in.readLine());
- }
- catch (IOException io) {
- io.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement