Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 26th, 2012  |  syntax: None  |  size: 0.85 KB  |  views: 193  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.io.*;
  2. import java.net.*;
  3.  
  4. public class SOK_1_SERVER
  5. {
  6.  
  7.         public static void main(String[] args) throws Exception
  8.         {
  9.             SOK_1_SERVER SERVER = new SOK_1_SERVER();
  10.             SERVER.run();
  11.         }
  12.        
  13.         public void run() throws Exception
  14.         {
  15.             ServerSocket SRVSOCK = new ServerSocket(444);
  16.             Socket SOCK = SRVSOCK.accept();
  17.             InputStreamReader IR = new InputStreamReader(SOCK.getInputStream());
  18.             BufferedReader BR = new BufferedReader(IR);
  19.            
  20.             String MESSAGE = BR.readLine();
  21.             System.out.println(MESSAGE);
  22.            
  23.             if (MESSAGE !=null)
  24.             {
  25.                 PrintStream PS = new PrintStream(SOCK.getOutputStream());
  26.                 PS.println("Message recieved");
  27.             }
  28.         }
  29.     }
clone this paste RAW Paste Data