Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- import java.io.*;
- public class chatClient
- {
- public static void main(String args[])throws Exception
- {
- Socket sk = new Socket("127.0.0.1",2000);
- BufferedReader sin = new BufferedReader(new InputStreamReader(sk.getInputStream());
- PrintStream sout = new PrintStream(sk.getOutputStream());
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- String s;
- while(true)
- {
- System.out.print(:Client:");
- s = stdin.readLine();
- sou.println(s);
- s = sin.readLine();
- System.out.print("Server: "+s+"\n");
- if(s.equalsIgnoreCase("BYE"))
- break;
- }
- sk.close();
- sin.close();
- sout.close();
- stdin.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement