Web engineering ( 5 Sep. 2012 )

import java.net.*;
import java.io.*;


class MyServer_aft{



public static void main(String p[])throws Exception{
    ServerSocket ss;
    Socket s;
    BufferedReader in;
    String str;

    ss=new ServerSocket(4000);
    s=ss.accept();
    in=new BufferedReader(new InputStreamReader(s.getInputStream()));

    while((str=in.readLine())!=null){

        System.out.println(str);
    }
          }
              }



----------------------------




compile and run this program than
 go to run dialog  box and type in " Telnet "
a command prompt will open than
type in " o "
if YOU are connecting to a local server that means You are connecting to your own P.C than
type in " 127.0.0.1 "
hit enter
type any message its will show on other window

if You are connecting over internet than provide IP address of other user to whom You are going to be connect.

Comments

Popular posts from this blog

Code for Database Connection confirmation PHP+HTML

Database connect with php

New Slides