Results 1 to 2 of 2
Thread: UDP Broadcast receiving
- 11-02-2010, 12:03 AM #1
Member
- Join Date
- Nov 2010
- Posts
- 2
- Rep Power
- 0
UDP Broadcast receiving
Hello, I've been googling and trying out a solution for hours now. I have an application on a different computer connected to a router. This app sends udp broadcasts on a specific port on the address 255.255.255.255. The other application which is the one I'm making is in java and needs to receive this broadcast. I have tried several times to make this work without success. Here is my progress if it helps:
Thanks in advanceJava Code:new Thread() { public void run() { try { int port = 8094; DatagramSocket dsocket = new DatagramSocket(port); byte[] buffer = new byte[2048]; DatagramPacket packet = new DatagramPacket(buffer, buffer.length); while (true) { System.out.println("Receiving..."); dsocket.receive(packet); String msg = new String(buffer, 0, packet.getLength()); System.out.println(packet.getAddress().getHostName() + ": " + msg); packet.setLength(buffer.length); } } catch (Exception e) { e.printStackTrace(); } } }.start();
- 11-02-2010, 01:42 AM #2
Member
- Join Date
- Nov 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Accept Connect Request and Read Broadcast
By lockcompetition in forum NetworkingReplies: 2Last Post: 03-28-2010, 02:43 AM -
Receiving Message in J2ME
By java girl in forum CLDC and MIDPReplies: 2Last Post: 10-27-2009, 05:49 AM -
fake ARP broadcast packet
By junkredish in forum NetworkingReplies: 0Last Post: 09-06-2008, 06:01 PM -
Receiving UDP pockets
By Java Tip in forum java.netReplies: 0Last Post: 04-07-2008, 08:08 PM -
broadcast messaging
By bhanu in forum NetworkingReplies: 1Last Post: 10-30-2007, 11:41 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks