Hi All,
I am trying to create a udp socket.
It works fine but the program hhangs for a few seconds[at DatagramSocket clientSocket = new DatagramSocket();] before ti actually sends the data out.Could any one tell me why?
try
{
System.out.println("Creating datagram");
DatagramSocket clientSocket = new DatagramSocket();
InetAddress IPAddress =
InetAddress.getByName("localhost");
byte[] sendData;
byte[] receiveData = new byte[1024];
String sentence ="TEST";
sendData = sentence.getBytes();
DatagramPacket sendPacket =
new DatagramPacket(sendData, sendData.length,
IPAddress, 9876);
clientSocket.send(sendPacket);
}
Cheers,
Sam