Skip to main content

Posts

Showing posts from January, 2012

FILE SYSTEM CONTROLS

Steps to perform File System Control 1. Open VB application 2.To drag and drop the Directorylistbox,Drivelistbox,Filelistbox tools to our form 3.Add two button control and image controls. 4.image control used to display the user select images. 5.Run the application PROGRAM: Private Sub Drive1_Change() Dir1.Path = Drive1.Drive File1.Path = Dir1.Path End Sub Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Private Sub OK_Click() On Error Resume Next Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName) Label1.Caption = Drive1.Drive + Dir1.Path + "\" + File1.FileName End Sub Private Sub EXIT_Click() End End Sub OUTPUT:

CALCULATOR USING CONTROL ARRAY

Public curval As Double Public preval As Double Public choice As String Public result As Double Private Sub cmd_Click(Index As Integer) Text1.Text = Text1.Text &cmd(Index).Caption curval = Val(Text1.Text) End Sub Private Sub cmdac_Click() curval = preval = 0 Text1.Text = "" End Sub Private Sub cmddiv_Click() Text1.Text = "" preval = curval curval = 0 choice = "/" End Sub Private Sub cmdequal_Click() Select Case choice Case "+" result = preval + curval Text1.Text = Str(result) Case "-" result = preval - curval Text1.Text = Str(result) Case "*" result = preval * curval Text1.Text = Str(result) Case "/" result = preval / curval Text1.Text = Str(result) End Select curval = result End Sub Private Sub CMDEXIT_Click() End End Sub Private Sub cmdminus_Click() Text1.Text = "" preval = curval curval = 0 choice = "-" End Sub Private Sub cmdmul_Click() Text1.Text = "

HTTP USING C

SERVER #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> int main() { int sock, connected, bytes_recieved , true = 1; char send_data [1024] , recv_data[1024]; char rep[40]={"File Received"}; int s,i,f=0; struct sockaddr_in server_addr,client_addr; int sin_size; if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror("Socket"); exit(1); } if (setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&true,sizeof(int)) == -1) { perror("Setsockopt"); exit(1); } server_addr.sin_family = AF_INET; server_addr.sin_port = htons(2500); server_addr.sin_addr.s_addr = INADDR_ANY; if (bind(sock, (struct soc

RPC USING JAVA

Filename: rint.java import java.io.*; import java.rmi.*; public interface rint extends Remote { public int add(int a,int b)throws RemoteException; public int sub(int x,int y)throws RemoteException; public int mul(int p,int q)throws RemoteException; } File Name: rclass.java import java.io.*; import java.rmi.*; import java.net.*; import java.rmi.server.*; public class rclass extends UnicastRemoteObject implements rint { public rclass() throws RemoteException{} public int add(int a,int b) throws RemoteException { int c=a+b; return c; } public int sub(int x, int y) throws RemoteException { int d=x-y; return d; } public int mul(int p, int q) throws RemoteException { int e=p*q; return e; } } File Name: sclass.java Import java.io.*; import java.rmi.*; import java.net.*; public class sclass { public static void main(String args[ ]) { try { rclass r=new rclass(); Naming.rebind("sum",r); } catch(Excep

SIMULATION OF ROUTING PROTOCOLS USING C

#include<stdio.h> #include<ctype.h> int graph[12][12]; int e[12][12]; int ad[12]; int no,id,adc,small,chosen,i,j,ch1,ch2; char nodes[12]={"abcdefghijkl"}; int main() { adc=0; printf("Enter The Number Of Nodes: "); scanf("%d",&no); printf("\nEnter The Values For Adjacency Matrix\n"); for(i=0;i <no;i++) { for(j=0;j <no;j++) { printf("Enter The Values For %d,%d Position: ",(i+1),(j+1)); scanf("%d",&graph[i][j]); } } printf("\nEnter The Initial Estimates\t"); for(i=0;i <no;i++) { printf("\nEstimate For Node %c:\n",nodes[i]); for(j=0;j <no;j++) { printf("To Node %c : ",nodes[j]); scanf("%d",&e[i][j]); } } do { printf("\nMENU:\n1.ROUTING INFO FOR NODE"); printf("\n2.ESTIMATED TABLE\n"); printf("Enter Your Choice: "); scanf("%d",&ch1); switch(ch1) { case 1: printf("\nW

SIMULATION OF SLIDING WINDOW PROTOCOLS USING C

SENDER #include<sys/socket.h> #include<sys/types.h> #include<netinet/in.h> #include<netdb.h> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<unistd.h> #include<errno.h> int main() { int sock,bytes_received,connected,true=1,i=1,s,f=0,sin_size; char send_data[1024],data[1024],c,fr[30]=" "; struct sockaddr_in server_addr,client_addr; if((sock=socket(AF_INET,SOCK_STREAM,0))==-1) { perror("Socket not created"); exit(1); } if(setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&true,sizeof(int))==-1) { perror("Setsockopt"); exit(1); } server_addr.sin_family=AF_INET; server_addr.sin_port=htons(17000); server_addr.sin_addr.s_addr=INADDR_ANY; if(bind(sock,(struct sockaddr *)&server_addr,sizeof(struct sockaddr))==-1) { perror("Unable to bind"); exit(1); } if(listen(sock,5)==-1) { perror("Listen"); exit(1); } fflush(stdout); sin_size=sizeof(st