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(1234);
- Socket socket = serverSocket.accept();
- System.out.println("Konekcijata e uspesna!");
- BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- String serverPoraka = input.readLine();
- PrintWriter output = new PrintWriter(socket.getOutputStream(), true);
- System.out.println("Serverot vika: " + serverPoraka);
- }
- catch (IOException ex) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement