Results 1 to 3 of 3
  1. #1
    Frielspak is offline Member
    Join Date
    Apr 2011
    Rep Power

    Default Problem reciving UDP Packets on Linux

    Hello i made a simple code to test a program that i was doing.

    The code is here:

    Java Code:
    . . .
    public static final byte precond[] = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
    public static final byte aftercond[] = {(byte) 0x0a,(byte) 0x00};
    String msg = new String(precond) + "challenge rcon" + new String(aftercond);
          String aux = "";
          DatagramSocket sc2 = new DatagramSocket(27020);
          DatagramPacket pkt = new DatagramPacket(msg.getBytes(),msg.length(),InetAddress.getByName(""),27050);
          DatagramPacket pkt2 = new DatagramPacket(new byte[1024],1024);
          String recived = new String(pkt2.getData(),0,pkt2.getLength());
          aux = recived.split(" ")[2].trim();
          System.out.println("RECIVED - " + aux);
    . . .
    Well this is a simple code the only think it does it's to send a udp packet to a server and server will respond.

    The problem it's, this work's on Windows but it DON'T work on ubuntu(server/desktop edition, iam not saying in linux, because i haven't tried in another destro).

    I already checked IPtables everything related with router but i can't solve this, the code run until 1st System.out then it block's waiting for the response, but the response on ubuntu never arrived :S

    Can some one help please?
    Last edited by Fubarable; 04-30-2011 at 06:58 PM. Reason: code tags added

  2. #2
    agienthea is offline Member
    Join Date
    Jul 2011
    Rep Power


    Hi. seem to be i have a same problem like yours.. but until now i still figure it out how to managed this.. does anyone have a solution for this.?

  3. #3
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Stockholm, Sweden
    Blog Entries
    Rep Power


    Have you tried sleeping*?

    Also have you tried loopback address ( instead of your IP?

    How is it going with TCP?

    *That is insert short [c:a 100 ms at most] sleeps between statements.
    Last edited by Hibernate; 08-07-2011 at 07:38 AM.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

Similar Threads

  1. JDBC Problem On linux
    By arshadalisoomro in forum JDBC
    Replies: 2
    Last Post: 03-10-2011, 04:56 PM
  2. problem with browser Listener in linux
    By chakribobby in forum SWT / JFace
    Replies: 0
    Last Post: 06-14-2010, 04:54 PM
  3. Problem with FreeRapid in Linux
    By jacatone in forum Java Applets
    Replies: 5
    Last Post: 06-13-2010, 06:03 AM
  4. Replies: 6
    Last Post: 04-08-2009, 05:05 AM
  5. problem with ServerSocket on Linux
    By gabriel in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts