Pace university


// IP address and Port Number


Download 121.03 Kb.
Pdf ko'rish
bet28/29
Sana05.01.2022
Hajmi121.03 Kb.
#207578
1   ...   21   22   23   24   25   26   27   28   29
Bog'liq
ahujajasmine

// IP address and Port Number 

         display.appendText( "Created Socket\n" ); 

 

         output = client.getOutputStream(); 



         input = client.getInputStream(); 

         display.appendText( "Sending Data .. Hello World\n" ); 

         String s = new String("Hello World \n"); 

 

         for (int i = 0; i < s.length(); i++) 



                output.write( (int) s.charAt(i)); 

 

 



        display.appendText("\n Received from Server:\n \t"); 

        char c

 

        while((c = (char) input.read() ) != '\n') 



                display.appendText(String.valueOf(c)); 

 

         display.appendText( "\nTransmission Complete\n" ); 



         client.close();    

      } 


      catch ( IOException e ) { 

         e.printStackTrace(); 

      } 

   } 


 

 

 



 


 

   public boolean handleEvent( Event e ) 



   { 

      if ( e.id == Event.WINDOW_DESTROY ) { 

         hide(); 

         dispose();  

         System.exit( 0 ); 

      } 


 

      return super.handleEvent( e ); 

   } 

 

   public s tatic void main( String args[] ) 



   { 

      Client c = new Client(); 

 

      c.runClient(); 



   } 




 




Download 121.03 Kb.

Do'stlaringiz bilan baham:
1   ...   21   22   23   24   25   26   27   28   29




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling