Showing posts with label computer networks. Show all posts
Showing posts with label computer networks. Show all posts

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