Wednesday, 12 November 2014

Network Simulation Using NS2

#Create a simulator object
set ns [new Simulator]

#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red

#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Define a 'finish' procedure
proc finish {} {
        global ns nf

Click here to view the complete code..

Friday, 7 November 2014

Program for distance vector routing using java




import java.io.*;
class distance_vector
{
public static void main(String arg[])throws Exception
{
int n,src,i,j,k;
String ch;
int a[][]=new int[10][10];
System.out.println("Enter the no. of nodes..");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
n=Integer.parseInt(br.readLine());
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)

Read more

Saturday, 30 August 2014

java program to implement bit stuffing

In data transmission and telecommunication, bit stuffing is the insertion of non information bits into data. Stuffed bits should not be confused with overhead bits.

Applications:Controller area network,Universal serial bus,HDLC

Click here to view sender program
Click here to view receiver program

Monday, 25 August 2014

java program to ping an ip address

import java.io.*; class ping { public static void main(String a[])throws Exception { String IP; String cmd; BufferedReader br=new BufferedReader(new InputStreamReader(System.in));


Read more...

finding ip address of a computer using java program

import java.io.*; import java.net.InetAddress; public class ipadd{ public static void main(String[] args) { boolean flag=false; String str=""; try {


Read more..

Sunday, 24 August 2014

Remote method invocation(RMI)

The Java Remote Method Invocation (Java RMI) is a Java API that performs the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes and distributed garbage collection.


Click here to view compiling procedure
Click here to view server interface
Click here to view server implementation
Click here to view server program
Click here to view client program

Program for exchange of information(communication through UDP)

import java.io.*; import java.net.*; import java.util.*; public class UdpReceiver { public static void main(String args[])throws IOException { try { DataInputStream dis=new DataInputStream(System.in); byte[] rdata=new byte[1024];


Click here for Udp Receiver
Click here for Udp Sender

Sunday, 17 August 2014

Implementing stack (with arrays)operations using dynamic memory allocation

#include<stdio.h>
#include<stdlib.h>
void push();
void pop();
void display();
int *stack,*top,n;
void main()
{
int ch;
printf("Enter the size of stack:\n");

Read more...

Dynamic memory allocation using calloc()

#include #include int *a,*t,n; void main() { printf("Enter the size of array:\n");

Read more...

Friday, 15 August 2014

Demonstrating mouse motion listener interface-2


import java.applet.*; import java.awt.*; import java.awt.event.*; import java.lang.Math; public class Brush2 extends Applet implements MouseMotionListener { int width, height; Image backbuffer; Graphics backg; int mx, my; double t = 0;

Read more...

Demonstrating mouse motion listener Interface-1


import java.applet.*; import java.awt.*; import java.awt.event.*; public class Brush1 extends Applet implements MouseMotionListener { int width, height; Image backbuffer; Graphics backg; public void init() { width = getSize().width; height = getSize().height;

Read more...

Thursday, 14 August 2014

Demonstration of card layout


import java.applet.*; import java.awt.*; import java.awt.event.*; public class cardlayout extends Applet implements ActionListener,MouseListener { Button win,other; Checkbox win98,winnt,solaris,mac; Panel oscards; CardLayout cardlo;

Read more...

Demonstration of scrollbars


import java.applet.*; import java.awt.*; import java.awt.event.*; public class scrolldemo extends Applet implements AdjustmentListener,MouseMotionListener { Scrollbar VB,HB; String msg=" "; public void init() { int wh=Integer.parseInt(getParameter("width")); int ht=Integer.parseInt(getParameter("height"));

Read more...

Saturday, 9 August 2014

Java applet program to illustrate mouse events

import java.applet.* import java.awt.* import java.awt.event.*; /*applet code="change.class" width=600 height=600> public class change extends Applet implements MouseListener public void init() addMouseListener(this)

Read more...

Wednesday, 11 June 2014

java program to create a stick figure

import java.applet.*; import java.awt.*; public class stickman extends Applet { public void init() //initialisation { setBackground(Color.black); setForeground(Color.red); }

Read more...

java program to create a dialog box using frames

import java.applet.*; import java.awt.*; import java.awt.event.*; class sampledialog extends Dialog implements ActionListener { sampledialog(Frame parent,String title) { super(parent,title,false); setLayout(new FlowLayout()); setSize(500,500); Button b1=new Button("click!"); add(b1); b1.addActionListener(this); }

Read more..

Tuesday, 10 June 2014

java program to create a File dialog using frames

import java.applet.*; import java.awt.*; import java.awt.event.*; class menuframe extends Frame { public menuframe(String title) { super(title); mywindowadapter adapter=new mywindowadapter(this); addWindowListener(adapter);

Read more...