Wednesday, March 12, 2008

Simple Server

/* This is simple server program in java running with port no 8000 */

import java.net.*;
import java.io.*;
public class server
{
ServerSocket ss;
Socket c;
DataInputStream din;
DataOutputStream dos;
public void start()
{
try{
ss=new ServerSocket(8000);
c=ss.accept();
din=new DataInputStream(c.getInputStream());
dos=new DataOutputStream(c.getOutputStream());
String str=din.readUTF();
System.out.println(str);
dos.writeUTF("hello client........");
c.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
public static void main(String args[])
{
server ser;
ser=new server();
ser.start();
}
}

1 comment:

Anonymous said...

Telll Rapidshare Account

My

Id
is
ankit4uat187@gmail.com

Sign by Rohit Lagu - SUPPORTED BY WE AND COMPUTER