FTP Server and Client Thursday, Jan 7 2010 

FTP Program

Server Program:

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

public class Server
{
public static void main(String asd[]) throws Exception
{
ServerSocket ss=new ServerSocket(1024);
System.out.println(“ServerSocket Generated”);
Socket s=ss.accept();
System.out.println(“ServerSocket Accepted”);
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintStream p=new PrintStream(s.getOutputStream());
String fname,str;
(more…)

Remote Command Server & Client Friday, Dec 12 2008 

Remote Command Execution

rceServer

import java.io.*;

import java.net.*;

public class rceserver

{

public static void main(String a[])throws IOException

{

ServerSocket s = new ServerSocket(8001);

System.out.println(“Started: “+ s);

try

{

Socket scr = s.accept();

(more…)

Datagram Server & Client Friday, Dec 12 2008 

Socket Programming – UDP

DatagramClient

import java.io.*;

import java.net.*;

class datagramclient

{

public static DatagramSocket ds;

public static byte buffer[]= new byte[1024];

public static int clientport = 789, serverport = 790;

public static void main(String args[]) throws Exception

{

ds=new DatagramSocket(serverport);

(more…)

Chat Server & Client Friday, Dec 12 2008 

Socket Programming TCP/IP

Chat Client

import java.io.*;

import java.net.*;

public class chatclient

{

public static void main(String args[])

{

String line;

String myline;

BufferedReader in=null;

try

{

Socket s=new Socket(“localhost”,8182);

(more…)

Day Time Server & Client Friday, Dec 12 2008 

//TDSERVER

import java.net.*;

import java.io.*;

import java.util.*;

import java.text.*;

class tdserver

{

public static void main(String a[]) throws Exception

{

ServerSocket ss;

Socket s;

PrintStream p;

DataInputStream din;

Date d1=new Date();

ss=new ServerSocket(8000);

s=ss.accept();

(more…)