Csma CA Program11
Csma CA Program11
AIM: To study and implement the Carrier Sense Multiple Access with collision avoidance.
PRINCIPLE:
Carrier sense multiple access with collision avoidance (CSMA/CA) is a method in which carrier
sensing is used, nodes attempt to avoid collisions by transmitting only when the channel is
sensed to be "idle"
ALGORITHM
1. Start
2. Initialize k=0
Receiver side:
//CSMA/CA
//CLIENT 2
import java.io.*;
import java.net.*;
class server
{
public static void main(String[] args)
{
try
{
System.out.println("============ Client 2 ===============");
while(true)
{
ServerSocket ss = new ServerSocket(137);
System.out.println("Waiting for connection");
ss.accept();
ss.close();
System.out.println("Connected");
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Output1:
Output2:
Sender side : Client1