Results 1 to 2 of 2
- 06-23-2010, 04:41 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 20
- Rep Power
- 0
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.....
- 06-24-2010, 02:19 AM #2
Similar Threads
-
path of packets
By priyacvr in forum Java ServletReplies: 1Last Post: 10-30-2009, 08:10 AM -
Reading TCP Packets
By Clive in forum NetworkingReplies: 0Last Post: 07-09-2009, 02:02 PM -
Java code that allows me to make and receive calls, send and receive sms
By nareshbabu@live.in in forum NetworkingReplies: 0Last Post: 12-02-2008, 10:55 AM -
Encrypting packets
By bugger in forum NetworkingReplies: 2Last Post: 02-04-2008, 10:24 AM -
How to capture IP packets
By Hasan in forum NetworkingReplies: 1Last Post: 05-31-2007, 05:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks