postheadericon Example of command line argument in C on Linux

args.c

#include "stdio.h"
void main(int c, char *argv[])
{
    int i;
    for(i=0;i<c;i++)
    {
        printf("\nargument[%d] : %s",i,argv[i]);    
    }
}

postheadericon Example of command line argument in Java

args.java

public class args
{
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
System.out.println("argument[ "+i+" ] : "+args[i]);
}
}
}

postheadericon AES with CBC mode example in Java

AESCBC.java

package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public AESCBC() throws Exception
{

postheadericon AES with CFM mode example in Java

AESCFM.java

package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public AESCFM() throws Exception
{

postheadericon AES with ECB mode example in Java

AESECB.java

package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class AESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public AESECB() throws Exception
{

postheadericon 3DES with CFM mode example in Java

D3ESCFM.java

package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public D3ESCFM() throws Exception
{

postheadericon 3DES with CBC mode example in Java

D3ESCBC.java

package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public D3ESCBC() throws Exception
{

postheadericon 3DES with ECB mode example in Java

D3ESECB.java


package bsr;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class D3ESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public D3ESECB() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DESede");
myDesKey = keygenerator.generateKey();

postheadericon RSA Encryption Example in Java

RSA.java

import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
class RSA
{
public KeyPairGenerator keygenerator;
public KeyPair myKey;
Cipher c;
public RSA() throws Exception
{
// Genrate the Key
keygenerator = KeyPairGenerator.getInstance("RSA");
keygenerator.initialize(1024) ;
myKey = keygenerator.generateKeyPair();

postheadericon JSP JDBC Example

Develop a JSP Page to perform database driven operations like insert, Delete, Update and selection with table named Student having fields like StudId, Name, Address, result.



Create Table in Oracle / MySQL [ student ]

CREATE TABLE   student (
StudId NUMBER( 4 ) NOT NULL ,
Name VARCHAR( 15 ) NOT NULL ,
Address VARCHAR( 20 ) NOT NULL ,
result NUMBER( 8 ) NOT NULL
)


postheadericon example of preparedstatement in java


Create Table in MySql [ Employee ]


CREATE TABLE  `wtad`.`Employee` (
`EmpId` INT( 4 ) NOT NULL ,
`Empname` VARCHAR( 15 ) NOT NULL ,
`Emp_desig` VARCHAR( 20 ) NOT NULL ,
`Emp_J_Date` VARCHAR( 20 ) NOT NULL ,
`Emp_Salary` INT( 8 ) NOT NULL
) ENGINE = MYISAM ;

Create Table in Oracle [ Employee ]

postheadericon example of page directive in jsp

index.jsp

<html>
<head>
<title>EX-35</title>
</head>
<body>
<%@ page language="java" %>
<%@ page info="A code from www.BipinRupadiya.com"  %>
<ul>
<li><a href="import.jsp">Example of page directive import </a></li>
<li><a href="isThreadsafe.jsp">Example of page directive isThreadsafe </a></li>
<li><a href="jsp-forward.jsp">Example of page directive jsp-forward </a></li>
<li><a href="contentType.jsp">Example of page directive contentType </a></li>
<li><a href="errorPage.jsp">Example of page directive isErrorPage and errorPage </a></li>
</ul>
<body>
</html>


postheadericon example of jsp scripting elements

index.jsp

<html>
<head>
<title>EX-36</title>
</head>
<body>
<!-- Declaration -->
<%!
int i=0;
int n=10;
int ans=0;
%>

postheadericon Example of requestdispatcher

index.jsp

<html>
<head>
<title>MySqlLogin</title>
<style>
.abc
{
background:#ababff;
position:absolute;
top:2in;
hieght:200px;
width:300px;
left:5in;
border-style:solid;
}
</style>
</head>

postheadericon JSTL standard tag library Example

index.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<HTML>
<HEAD>
<TITLE>WTAD: Ex31 : www.BipinRupadiya.com</TITLE>
</HEAD>
<BODY>
<h3>Example of JSTL standard tag library.</h3>
<ul>
<li><a href="set.jsp">set, remove and out</a></li>
<!-- Example of c:for -->
<li><a href="for.jsp">for</a></li>
<!-- Example of c:if -->
<li><a href="if.jsp">if</a></li>
<!-- Example of c:choose -->
<li><a href="choose.jsp">choose</a></li>
<!-- Example of c:redirect and c:param -->
<li><a href="redirect.jsp">redirect</a></li>

</ul>
</BODY>
</HTML>

postheadericon DES with CBC mode example in Java

DESCBC.java

class DESCBC
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public DESCBC() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DES");
keygenerator.init(new SecureRandom());
myDesKey = keygenerator.generateKey();

postheadericon DES with CFM mode example in Java

DESCFM.java

class DESCFM
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;
public IvParameterSpec iv;
public DESCFM() throws Exception
{
// Genrate the Key
keygenerator = KeyGenerator.getInstance("DES");
keygenerator.init(new SecureRandom());
myDesKey = keygenerator.generateKey();

postheadericon DES with ECB mode example in Java

DESECB.java

import bsr.*;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
/*A code from www.bipinrupadiya.com*/
class DESECB
{
public KeyGenerator keygenerator;
public SecretKey myDesKey;
Cipher c;

postheadericon One Time Pad Encryption Example using Java code

Write a programs to simulate encryption and decryption technique using One Time Pad, algorithm development and Communication between client and server should be done using Java server socket programming.


OneTimePad.java


package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class OneTimePad
{
public String doEncryption(String s)
{
int i,j;

postheadericon S-Box Example using Java

Write a programs to simulate encryption and decryption technique using S-Box, algorithm development and Communication between client and server will be done using Java server socket programming.

SBOX.java

package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class SBOX
{
public String doEncryption(String s)// throws Exception
{
int i,temp;

postheadericon P-Box Example using Java

Write a programs to simulate encryption and decryption technique using P-Box, algorithm development and Communication between client and server will be done using Java server socket programming.

P-Box.java

package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class PBOX
{
public String doEncryption(String s)
{
int i,temp;

postheadericon Transposition cipher example using Java

Write a programs to simulate encryption and decryption technique using Transposition (Columnar) Cipher, algorithm development and Communication between client and server will be done using Java server socket programming.

TranspositionCipher.java

package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class TranspositionCipher
{
public String selectedKey;
public char sortedKey[];
public int  sortedKeyPos[];

postheadericon Mono-alphabetic Substitution Cipher example using Java

Write a programs to simulate encryption and decryption technique using Mono-alphabetic Substitution Cipher, algorithm development and Communication between client and server will be done using Java server socket programming.

MonoAlphabeticSubstitutionCipher.java

package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class MonoAlphabeticSubstitutionCipher
{
public char p[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
public char ch[] = {'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M'};
public String doEncryption(String s)
{

postheadericon Generalized Caesar Cipher example using java

Write a programs to simulate encryption and decryption using Caesar Cipher. algorithm development and Communication between client and server is done using Java socket programming.


CaesarCipher.java

package bsr;
import java.util.*;
import java.net.*;
import java.io.*;
/*A code from www.bipinrupadiya.com*/
public class CaesarCipher
{
char a[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int key=3;

postheadericon java socket programming example



In the era of network programming means write such a script that can be executed on multiple computers / platform. In J2SE, a package java.net provide the number of API that can be used to write code for the communication between multiple computers / platforms. The java.net package of J2SE provide the sport for two important protocol of the network that is TCP and UDP.

The Socket in java provide the way of communication between two or more computers using Transmission Control Protocol (TCP). Here we have  socket  on both side at Client as well as server. A client socket try to communicate to server socket. If everything is fine server accept the connection and communication process begin.

Here I am going to demonstrate a simple example of server socket programming. I have created a java package  bsr and my class that have the definition of socket MySocket.java is placed inside this package. 

I have also created two more class to simulate the behavior of client and server namely sender and  receiver. I used plain text editor to create my script.


Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.