Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.*;
- public class MyClient{
- public MyClient(String ip, int port){
- String message;
- try{
- Socket me = new Socket(ip, port);
- System.out.println("Server connected");
- DataInputStream dis = new DataInputStream(me.getInputStream());
- DataOutputStream dos = new DataOutputStream(me.getOutputStream());
- message = (String) dis.readUTF();
- System.out.println("Message received : " + message);
- dos.writeUTF("GG");
- me.close();
- System.out.println("Closed");
- }catch(Exception e){
- System.out.println(e);
- }
- }
- public static void main(String[] args){
- MyClient server = new MyClient("localhost",10074);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement