Theory:-
RJ45, RJ45s, and 8P8C
RJ45 plugs feature eight (8) pins to which the wire strands of a cable interface electrically. Each plug has eight locations (positions), spaced about 1mm apart, into which individual wires are inserted using special cable crimping tools.The industry calls this type of connector 8P8C (Eight Position, Eight Contact).
Ethernet cables and 8P8C connectors must be crimped into the RJ-45 wiring pattern to function properly. Technically, 8P8C can be used with other types of connections besides Ethernet; it is also used with RS-232 serial cables, for example. Because RJ45 is by far the predominant usage of 8P8C, however, industry professionals commonly use those two terms interchangeably.
Traditional dial-up modems used a variation of RJ45 called RJ45s which features only 2 contacts (8P2C configuration) instead of eight. The close physical similarity of RJ45 and RJ45s made it difficult for an untrained eye to tell the two apart.
Wiring Pinouts of RJ45 Connectors
Two standard RJ45 pinouts define the arrangement of the individual eight wires needed when attaching connectors to a cable – the T568A and T568B standards. Both follow a convention of coating individual wires in one of five colors – brown, green, orange, blue and white – with certain stripe and solid combinations.
Procedure:-
1.Remove about 40mm of the jacket
2.Untwist the twisted paired wires
3. Arrange them in the order shown in the above table
4. Once the wires are arranged and are flat, cut them using the Crimpler so they are 13mm long.
5. Now use the crimpling tool to work. The crimp tool in the gold plated electrical contact down such that they pierce through insulations of all and make contact with the copper conductor This is called insulation displacement.
6. Now repeat the same steps to the other end of the wire to be used as the receiving signal. Except if you are using crossed connection the diagram to be followed will be different that of the straight wire connection.
7.Test the connection using a tester. If all the light are flashed and in a serial order, then the connection is perfect. Otherwise some error is reflected.
Observation:-
We successfully arrange the wires in order, insert them into the RJ45 using a crimpler and then test it using a LAN tester
Conclusion:
We see that the LAN tester is flashing all the 8 lights and they are in serial order. Hence our connection is verified and tested
Precaution:-
i) Do not strip the insulation of the off the individual paired wires
ii) Be careful not to cut through my coloured wires
iii) Check carefully before inserting the arranged wires in RJ-45
vi) Make sure you are not using a defective tester
v) Do not take too short cable wires
iv) Make sure all the 8 wires are touching the copper conductor
Experiment:-3
Aim:- write a program in java to implement echo client server
Algorithm:-
SERVER:
STEP 1: Start
STEP 2: Declare the variables for the socket
STEP 3: Specify the family, protocol, IP address and port number
STEP 4: Create a socket using socket() function
STEP 5: Bind the IP address and Port number
STEP 6: Listen and accept the client’s request for the connection
STEP 7: Read the client’s message
STEP 8: Display the client’s message
STEP 9: Close the socket
STEP 10: Stop
CLIENT:
STEP 1: Start
STEP 2: Declare the variables for the socket
STEP 3: Specify the family, protocol, IP address and port number
STEP 4: Create a socket using socket() function
STEP 5: Call the connect() function
STEP 6: Read the input message
STEP 7: Send the input message to the server
STEP 8: Display the server’s echo
STEP 9: Close the socket
STEP 10: Stop
Source code:-
import java.net.*;
import java.io.*;
public class EchoServer
{
public static void main(String [] args){
if (args.length<1)
{
System.out.println(“USAGE: “);
System.out.println(“TCPEcho Server portno “);
System.exit(0);
}
try{
System.out.println(“Opening Serversocket at port: “+args[0]);
ServerSocket serversocket =new ServerSocket(Integer.parseInt(args[0]));
System.out.println(“Accepting Clients”);
while(true)
{
Socket clientsocket=serversocket.accept();
clientsocket.setReceiveBufferSize(1500);
System.out.println(“client accepted.remote address: “+clientsocket.getInetAddress());
PrintWriter out=new PrintWriter(clientsocket.getOutputStream(),true);
BufferedReader in =new BufferedReader(new InputStreamReader(clientsocket.getInputStream()));
String inputline,outputline;
while((inputline=in.readLine())!=null)
{
System.out.println(“got msg from client : “+inputline);
outputline= inputline;
out.println(outputline);
out.flush();
}
System.out.println(“client dissconnected”);
out.close();
clientsocket.close();
}
}
catch(Exception e)
{
System.out.println(“something went wrong”);
System.out.println(e);
}
}
}
Source code for CLIENT:-
import java.net.*;
import java.io.*;
import java.util.*;
public class TcpEchoClient
{
public static void main(String [] argv)
{
if (argv.length<2)
{
System.out.println(“USAGE: “);
System.out.println(“TCPEcho Client portno “);
System.exit(0);
}
try{
Socket socket=new Socket(argv[0],Integer.parseInt(argv[1]));
BufferedReader fromServer=new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter toServer=new PrintWriter(socket.getOutputStream());
BufferedReader console =new BufferedReader(new InputStreamReader(System.in));
while(true)
{
System.out.println(“Enter something to send on server”);
String tosend=console.readLine();
System.out.println(“Sending to Server…….”);
toServer.println(tosend);
toServer.flush();
Thread.sleep(1);
try{
System.out.println(“Reading from server….”);
String Line=fromServer.readLine();
System.out.println(“respose”+Line);
}
catch(Exception e)
{
System.out.println(“something went wrong”);
System.out.println(e);
}
}
}
catch(Exception e)
{
System.out.println(“something went wrong”);
System.out.println(e);
}
}
}
OUTPUT:–
java EchoServer 1042
Opening Serversocket at port: 1042
Accepting Clients
client accepted.remote address: /10.103.90.41
got msg from client : hello
java TcpEchoClient 10.103.90.41 1042
Enter something to send on server
hello
Sending to Server…….
Reading from server….
resposehello
Enter something to send on server
Experiment :- 4
AIM:- Write a program in Java to retrieve the information about Host and Port.
Algorithm:-
Step 1: provide the full URL of the browser
step 2: use uri getHost() to get information about the host name
Step 3: use urlgetPort0 to get information about the port number
Step 4: use url get to get information about the protocol applied
Source Code:
import java.lang.* ;
import java.io.*;
import java.net.*;
class ud1
{
public static void main(String args []) throws
MalformedURLException
{ URL url = new URL(“http://www.yahoo.com”);
try
{
System.out.println(“host name is ” + url.getHost());
System.out.println(“port no. is ” + url.getPort());
System.out.println(“protocol used is ” + url.getProtocol());
}
catch (Exception e)
{ System.out.println(“error”+e);
}
}
}
OUTPUT:-
C:UsersbumkaDownloads>javac ud1.java
C:UsersbumkaDownloads>java ud1
host name is www.yahoo.com
port no. is -1
protocol used is http
C:UsersbumkaDownloads>