Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
1
Language: Java
Posted by: Zeeshan Ali
Added: Jan 9, 2021 10:41 PM
Views: 6
Tags: no tags
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package chat;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.InputStreamReader;
  10. import java.io.PrintWriter;
  11. import java.net.ServerSocket;
  12. import java.net.Socket;
  13. import javax.swing.JOptionPane;
  14.  
  15. /**
  16.  *
  17.  * @author Zeeshan
  18.  */
  19. public class client {
  20.      
  21.     Socket s;
  22.     PrintWriter pw;
  23.     public client(){
  24.         try {
  25.                s = new Socket(constants.URL,constants.PORT);
  26.                pw = new PrintWriter(s.getOutputStream());
  27.              //  if(s.isConnected()) {
  28.                    pw.println("Hello");
  29.                    pw.flush();
  30.              //  }
  31.         } catch (Exception e) {
  32.             JOptionPane.showMessageDialog(null, e.getMessage(),"E33 client",1);
  33.         }
  34.        
  35.     }
  36. }
  37.