Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    20
    Rep Power
    0

    Default not able to receive packets?? pls help.

    I am very to java and networking.
    I am trying to receive packets at port 1030 and printing on console.
    I am sending the packets from fpga board to pc.
    I could see the packets on wire shark but cant see on the console.
    The java code that i am using is


    import java.net.DatagramPacket;
    import java.net.DatagramSocket;
    import java.util.Date;


    public class main {public static void main( String args[] ) throws Exception {
    DatagramSocket socket = new DatagramSocket(1030);
    DatagramPacket packet = new DatagramPacket(new byte[512],512);
    while ( true ) {
    socket.receive( packet );
    System.out.println( ""+new Date()+" "+packet.getAddress()+":"+packet.getPort()+" "+new String(packet.getData(),0,packet.getLength()) );
    // socket.send( packet );
    }

    Couple of points:
    1. when i tried to see the port list using netstat -an command i could see port
    1030 but with ip:0.0.0.0. I am sending the packets from fpga to 192.168.0.1.
    Is this the reason y i am not receiving at the java end?
    2.The port state is neither established or listening? do i need to make the port to listening state before i receive the packet? if so, how do i do that?
    3. do i need to mention the ip address in the java code ? ( i mean ip of the pc)? and how do i do this?


    I really would appreciate if anyone can help me out.....

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,578
    Rep Power
    25

    Default

    sending the packets from fpga board
    could see the packets on wire shark
    No idea what those are.
    Have you tried a ServerSocket to see if it receives anything?

Similar Threads

  1. path of packets
    By priyacvr in forum Java Servlet
    Replies: 1
    Last Post: 10-30-2009, 08:10 AM
  2. Reading TCP Packets
    By Clive in forum Networking
    Replies: 0
    Last Post: 07-09-2009, 02:02 PM
  3. Replies: 0
    Last Post: 12-02-2008, 10:55 AM
  4. Encrypting packets
    By bugger in forum Networking
    Replies: 2
    Last Post: 02-04-2008, 10:24 AM
  5. How to capture IP packets
    By Hasan in forum Networking
    Replies: 1
    Last Post: 05-31-2007, 05:44 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
  •