Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Need Help to acquire data from a connection UDP

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Location
    Germany
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need Help to acquire data from a connection UDP

    hello guys,

    i need help. i want to take data from a specific ip address and port and to display it.

    here is my code
    import java.net.DatagramSocket;
    import java.net.InetSocketAddress;
    import java.net.UnknownHostException;
     
    public class App {
     
    	public static void main (String[] args) throws UnknownHostException
    	{
    		try {
    	        DatagramSocket s = new DatagramSocket(null);
    	        InetSocketAddress address = new InetSocketAddress("141.41.1.250", 53);
    	        s.bind(address);
     
    	    } catch (Exception e) {
    	        e.printStackTrace();
    	    }
    	}
    }

    still it cant acquire the wanted data

    thanks before


  2. #2
    Junior Member
    Join Date
    Apr 2013
    Location
    Germany
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need Help to acquire data from a connection UDP

    hello guys,

    i need help. i want to take data from a specific ip address and port and to display it.

    here is my code
    import java.net.DatagramSocket;
    import java.net.InetSocketAddress;
    import java.net.UnknownHostException;
     
    public class App {
     
    	public static void main (String[] args) throws UnknownHostException
    	{
    		try {
    	        DatagramSocket s = new DatagramSocket(null);
    	        InetSocketAddress address = new InetSocketAddress("192.168.0.199", 8080);
    	        s.bind(address);
     
    	    } catch (Exception e) {
    	        e.printStackTrace();
    	    }
    	}
    }

    still it cant acquire the wanted data

    thanks before

  3. #3
    Member coderxx0's Avatar
    Join Date
    Feb 2013
    Location
    England, UK
    Posts
    61
    My Mood
    Cool
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Need Help to acquire data from a connection UDP

    Quote Originally Posted by clavius11 View Post
    hello guys,

    i need help. i want to take data from a specific ip address and port and to display it.

    here is my code
    import java.net.DatagramSocket;
    import java.net.InetSocketAddress;
    import java.net.UnknownHostException;
     
    public class App {
     
    	public static void main (String[] args) throws UnknownHostException
    	{
    		try {
    	        DatagramSocket s = new DatagramSocket(null);
    	        InetSocketAddress address = new InetSocketAddress("141.41.1.250", 53);
    	        s.bind(address);
     
    	    } catch (Exception e) {
    	        e.printStackTrace();
    	    }
    	}
    }

    still it cant acquire the wanted data

    thanks before
    Have you tried adding the Port.... to this section:
    Quote Originally Posted by clavius11 View Post
    InetSocketAddress address = new InetSocketAddress("141.41.1.250", 53);
    "53" Is not a valid port the ports are like "8080"

  4. The Following User Says Thank You to coderxx0 For This Useful Post:

    clavius11 (May 3rd, 2013)

  5. #4
    Junior Member
    Join Date
    Apr 2013
    Location
    Germany
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need Help to acquire data from a connection UDP

    SOLVED!! Thanks dude.
    guess I have missed something important before.

  6. #5
    Member coderxx0's Avatar
    Join Date
    Feb 2013
    Location
    England, UK
    Posts
    61
    My Mood
    Cool
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Need Help to acquire data from a connection UDP

    Quote Originally Posted by clavius11 View Post
    SOLVED!! Thanks dude.
    guess I have missed something important before.
    no problem

Similar Threads

  1. Shared connection or individual connection?
    By newbie14 in forum Java Networking
    Replies: 6
    Last Post: January 12th, 2013, 04:10 AM
  2. Replies: 0
    Last Post: March 26th, 2011, 11:07 AM
  3. Replies: 4
    Last Post: September 19th, 2009, 11:56 PM

Tags for this Thread