Created
December 7, 2022 23:00
-
-
Save hamzamuric/66d33ef1d807889b4152402aad66a674 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.util.Scanner; | |
import java.io.PrintWriter; | |
import java.io.IOException; | |
class Client { | |
public static void main(String[] args) throws IOException { | |
int host = 3000; | |
Socket socket = new Socket("localhost", 3000); | |
Scanner in = new Scanner(socket.getInputStream()); | |
PrintWriter out = new PrintWriter(socket.getOutputStream(), true); | |
Scanner console = new Scanner(System.in); | |
while (true) { | |
String odgovori = console.nextLine(); | |
out.println(odgovori); | |
String licnost = in.nextLine(); | |
System.out.println(licnost); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment