Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

EX.NO: 1 1.

RETRIVING DATA WITH URL


DATE :

AIM:

TO Retrieve a data with URLs using java.

ALGORITHM:

Step 1: Start the Program.

Step 2: Create a object of URL and assign the URL Website


http://WWW.google.com.

Step 3: Create a object for URL Connection.

Step 4: Create BufferedReader class and assign the Input StreamReader.

Step 5: Create a object for string as inputLine.

Step 6: Create a While condition((inputLine=in.realLine())!=null)

Step 7: Print the String.

Step 8: Stop the Program.


RESULT:

Thus the above program has been executed successfully.

EX.NO: 2a 2a. IMPLEMENTATION OF SOCKET PROGRAMMING


DATE: USING TCP

AIM:

To Perform implementation of socket programming using TCP/IP.

ALGORITHM:

SERVER:

Step 1: Declare the string variable data.

Step 2: Create the ServerSocket object as server.

Step 3: Assign the Socket object as skt.

Step 4: Server has connected to the client.

Step 5: Print the OutputStream.

Step 6: Print the sending string and data .

Step 7: Close the PrintWriter .Socket,ServerSocket.

CLIENT:

Step 8: Start the Client Program

Step 9: Connect the socket address as localhost,1234.

Step 10: Assign the InputStreamReader on BufferedReader object.

Step 11: Now print the string data.

Step 12: Create while condition(!in.ready()).

Step 13: Read the String data and print the string.

Step 14: Close the BufferedReader.

Step 15: Stop the Client program.


RESULT:

Thus the above program has been executed successfully.

EX.NO: 2b 2b.IMPLEMENTATION OF SOCKET PROGRAMMING


DATE: USING UDP
AIM:
To perform implementation of socket programming using UDP.

ALGORITHM:

SERVER:

Step 1: Start the server program.

Step 2: Create a object for DatagramSocket.

Step 3: Create a object for byte class using array.

Step 4: Create BufferedReader class and assign the InputStreamReader.

Step 5: Print the string data.

Step 6: Create a object for InetAddress and getLocalHost().

Step 7: Create on object for DatagramPocket and assign buf,buf.length,ia,300.

Step 8: Send the dp to ds.

CLIENT:

Step 9: Start the client program.

Step 10: Create on object for byte class using array.

Step 11: Create on object for DatagramSocket,DatagtamPacket.

Step 12: Set the Boolen b=true.

Step 13: Create on object for String and assignbuf,0,dp.getLength()

Step 14: if str equals "ends".

Step 15: Stop the program.


RESULT:

Thus the above program has been executed successfully.

EX.NO: 3 3. IMPLEMENTATION OF FTP


DATE :

AIM:
To perform implementation of FTP.

ALGORITHM:

Step 1: Start the server program.

Step 2: Create on object for server socket,print writer, InputStreamReader,Buffered Reader,file


class.

Step 3: Socket to assign accept and print connection from.

Step 4: Print the enter file name and declare the string variable fn=brl.readLine().

Step 5: Assign the file object from fn and if(fi.exists()then.

Step 6: Create an object for BufferedRreder and declare the string variable.

Step 7: While ((fdata=(br2.readLine()!null) then print wirte(fdata).

Step 8: Else and print file+fit dode bot exit and using catch block print not found port and goto
step17.

Step 9: Start the client program.

Step 10: Create an object for socket,inputSteramReder,BufferedReader.

Step 11: Declare the string variable in and while((in=br.readLine())!=null)then.

Step 12: Print the content of the file is them print the string values.

Step 13: Close the BufferedReader and using catch.

Step 14: Again using catch block and print the IOExeception and doti step15.

Step 15: Stop the client program.

Step 16: Stop the server progeram and goto step9.


RESULT:

Thus the above program has been executed successfully.

EX.NO: 4a 4a.IMPLEMENTATION OF ECHO SERVER AND


DATE : CLIENT USING TCP

AIM:

To perform implementation of ECHO.


ALGORITHM:

Step 1: Create two program one for the server side and one for the client side.

Step 2: In the server side, create a server socket.

Step 3: The retrun value of the accept() method is assigened to new socket client.

Step 4: Send the input receved from the client the server side back to the client.

Step 5: In the client side, create a socket to connect to the server.

Step 6: Create the object of DataInputStream to accept input from the server.

Step 7: Display the input received from the server.

Step 8: Type _ quit at the client side to finish execution of both the programs.

Step 9: Stop.
RESULT:
Thus the above program has been executed successfully.

EX.NO: 4b 4b.IMPLEMENTATION OF PING SERVER


DATE : USING RAW SOCKET

AIM:

To perform implementation of PING.


ALGORITHM:

Step 1: Start the program.

Step 2: Get the frame size from the user.

Step 3: To create the frame based on the user request.

Step 4: To send frames to server from the client side.

Step 5: If your frames reach the server it will send ACK singal to client otherwise it will send
NACK signal to client.

Step 6: Stop the program.


RESULT:
Thus the above program has been executed successfully.

EX.NO: 4c 4c. IMPLEMENTATION OF TALK USING TCP


DATE :

AIM:

To perform implementation of TALK.


ALGORITHM:

Step 1: Start the program.

Step 2: Get the frame size from the user.

Step 3: To create the frame based on the user request.

Step 4: To send frames to server from the client side.

Step 5: If the frames reach the server it will send ACK signal to client otherwise it will send
NACK signal to client.

Step 6: Stop the program.


RESULT:
Thus the above program has been executed successfully.

EX.NO: 5 5. IMPLEMENTATION OF REMOTE


DATE : COMMAND EXECUTION USING TCP

AIM:
To perform implementation of remote command execution using TCP.

ALGORITHM:

Step 1: Start.

Step 2: Create a server socket at the server side.

Step 3: Create a socket at the client side and the connection is set to accept by the server socket
using the accept() method.

Step 4: In the client side the command to be executed is given as input.

Step 5: The command is obtained using the readLine() method of Buffer Reader.

Step 6: Get the runtime object of the runtime class using getruntime(0.

Step 7: Execute the command using the exec() method of runtime.

Step 8: Stop.
RESULT:

Thus the above program has been executed successfully.

EX.NO: 6 6. IMPLEMENTATION OF ARP


DATE :

AIM:
To perform implementation of ARP protocol.

ALGORITHM:
SERVER:

Step 1: Create a server socket and bind it to port.

Step 2: Listen for new connection and when a connection arrives, accept it.

Step 3: Send server “s date and time to the client.

Step 4: Read client :s IP address sent by the client.

Step 5: Display the client details.

Step 6: Repeat steps 2-5 until the server is terminated.

Step 7: Close all streams.

Step 8: Close the server socket.

Step 9: Stop.

CLIENT:

Step 1: Create a client socket and connect it to the server’s port number.

Step 2: Retrieve its own IP address using built-in function.

Step 3: Send its address to the server.

Step 4: Display the date & time sent by the server.

Step 5: Close the input and output streams.

Step 6: Close the client socket.

Step 7: Stop.
RESULT:

Thus the above program has been executed successfully.

EX.NO: 7 7. IMPLENTATION OF RARP


DATE :
AIM:

To perform implementation of socket programming using TCP/IP.

ALGORITHM:
SERVER:

Step 1: Create a server socket and bind it to port.

Step 2: Listen for new connection and when a connection arrives, accept it.

Step 3: Send server"s date and time to the client.

Step 4: Read client"s IIP address sent by the client.

Step 5: Display the client details.

Step 6: Repeat steps 2 – 5 until client server is terminated,

Step 7: Close all streams.

Step 8: Close the server socket.

Step 9: Stop.

CLIENT:

Step 1: Create a client socket and connect it to the server"s port number.

Step 2: Retrive its own IP address using built-in function.

S t e p 3:Send its address the server.

Step 4: Display the date & time sent by the server.

Step 5: Close the input and output streams.

Step 6: Close the client socket.

Step 7: Stop.
RESULT:

Thus the above program has been executed successfully.

EX.NO: 8 8. IMPLEMENTATION OF RMI/RPC


DATE :

AIM:

To perform implementation of RMI/RPC.

ALGORITHM:
Step 1: Write an interface program with method AddServerIntf that finds the sum of
2 values.

Step 2: Write an implementation program to define the AddServerIntf with a


methods AddServerImpl methods.

Step 3: write a server program rmiserver in which the instance of the


implementation is created.

Step 4: Create a register by issuing the_start rmiregistry command at the command


prompt.

Step 5: Complie using the rmi complier the implementation program for creation of
the stub and skeleton.

Step 6: Bind the implementation object to the registry and name it.

Step 7: Write a client program in which the inputs of two values are obtaine from
the command line and the result is displayed.

Step 8: Stop.
RESULT:

Thus the above program has been executed successfully.

EX.NO: 9 9. IMPLEMENTATION OF SHORTEST PATH


DATE : COMPUTATION IN OSPE (DIJIKSTRA’S
ALGORITHM)

AIM:

To perform implementation of Shortest Path Routin Algorithm.


ALGORITHM:

Step 1: Start the program.

Step 2: Declare the variable distance[], cost[] as an array.

Step 3: Declare the variable flag,I,minpos=1,k,c,minimum.

Step 4: Using for loop upto I<n then assign flag[i]=0.

Step 5: Using for loop upto k<0n then assign minimum=this.distance[i].

Step 6: Create void main()

Step 7: Declare variable nodes,source,i,j.

Step 8: Create object for scanner.

Step 9: To get number of nodes as input.

Step 10: Using for loop upto nodes.

Step 11: Print the value of shortest path source to destination.

Step 12: Stop the program.


RESULT:

Thus the above program has been executed successfully.

EX.NO: 10 10. IMPLEMENTATION OF SLIDING WINDOW


DATE : PROTOCOL
AIM:

To perform implementation of Sliding Window Protocol.

ALGORITHM:
Step 1: Start the sender program.

Step 2: To create object ServerSocket and object Socket s=ser.accept().

Step 3: To create object DataInputStream and get DataInputStream.

Step 4: Assign value stringbuff[]=new string[8].

Step 5: Declare variable printstream p, int sptr=0,sws=8,nf,uno,I,string ch.

Step 6:Using do statement and assign value p=new


printstream(s.getoutputstream()).

Step 7: Print enter no of frames.

Step 8: To assign value nf=Interger.parseInt(in.readLine() and p.print nf.

Step 9: If(nf<=sws.1) then print the enter +nf value message to be send.

Step 10: Using for loop upto i<nf and assign sbuff[sptr]=in.readLine().

Step 11: P.print value sbuff[sptr] value then assign sort=++sptr%8.

Step 12: To assign aws+=nf then else print the no of frames exceeds windowsize.

Step 13: Print do you want to send some more frames and assign ch=in.readLine.

Step 14: P.print ch value and using while(ch.equals(“yes”)).

Step 15: Close the s and stop the sender program.

Step 16: Start the receiver program.

Step 17: create on object socket s=new socket(inetaddress.getlocalhost(),10).

Step 18: Using object DataInputStream and getInputStream.

Step 19: Using object printstream and get outputstream.

Step 20: Declare variable int i=(),rptr=-1,rws=8.string rbuf[]=new string[8],string


ch

Step 21: Using do statement and assign nf=Integer.parseInt(in.teadLine()).

Step 22: if(nf<rws-1)the using for loop upto i<=nf and assign rptr=++rptr
%8,Rbuf[rptr]=in.readLine().
Step 23: Print the received frame+rptr+is+rbut[rptr]value then assign rws-=nf.

Step 24: Print acknowledgement sent then print p.print(rptr+1);

Step 25: Assign rws+=nf then else assign ch=in.readLine();.

Step 26: While (ch.equals(“yes”)).

Step 27: Stop the program.


RESULT:

Thus the above program has been executed successfully

You might also like