3

I am making an application in C#. In that application I am listening data on particular port. But while listening data on that port, I am getting that packet data but I also want to listen header of that packet data (means sequence number,source port,destination port etc). The code for listening data is as:

 UdpClient client = null;
 IPEndPoint ipep = null;
 client = new UdpClient(9000); 
 ipep = new IPEndPoint(IPAddress.Any,9000);

  byte[] data= = client.Receive(ref ipep);
Mirza Sisic
  • 2,335
  • 4
  • 25
  • 35
Dany
  • 1,934
  • 8
  • 32
  • 54
  • http://stackoverflow.com/questions/2271183/udp-packet-capturing-in-c-sharp please see this past SO post if it helps @Dany – Devjosh Jan 09 '12 at 07:40
  • Is there any other way than it?Please – Dany Jan 09 '12 at 11:23
  • Is there any other way of getting header of received packet instead of RAW socket? – Dany Jan 09 '12 at 14:43
  • sequence number -- there is no sequence number in UDP. source port -- you can use recvfrom (sorry, ReceiveFrom in C#). -- target port: that would be always 9000 in your example. The only thing you don't see is the UDP header checksum.. – bew Feb 22 '12 at 10:19

0 Answers0