• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Can I get source ip address and destination ip address of udp packet?  RSS feed

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I get source ip address and destination ip address of udp packet?
 
vikas byn
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:See http://download.oracle.com/javase/6/docs/api/java/net/DatagramPacket.html#getSocketAddress%28%29



It will give information of Source address only.

actually I have one udp server in java at localhost and have some virtual interfaces on it.

now I send udp packet on this server at one virtual interface(say eth0:1). I received that packet but when extract information of source address only.

while i see tcpdump it will give information of source and destination.

that's why i am asking here if tcpdump get information of source and destination then java should have some api to get these information.

 
Sheriff
Posts: 21461
96
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you click on that link you are sure to see a few other methods that return other addresses. Try those first.
 
vikas byn
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:If you click on that link you are sure to see a few other methods that return other addresses. Try those first.



i tried it there are two methods for getting ip information - public SocketAddress getSocketAddress() and public InetAddress getAddress() - they give same address information.

actually i need three things - payload, source address and destination address (which is virtual interface in my case).

please forgive me for my bad english.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!