• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

udp port listening : where to start?

 
Phillip Kuon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm running java 1.5 on windows xp. I would like to develop an app which listens and stores data received on a certain port from an ip address.
My trouble is where to start? I do know i need to use java.net.datagramsocket

For instance, how do i test if the port is occupied locally by another service?
Should I assume it will just "catch" the udp datagrams floating around the local network?

thanks in advance.
 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can catch exception to check whether the port is already in use or not.

Thanks
Shan
 
Phillip Kuon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to output which service is occupying that port?
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably with JNI (CurrPorts can do it), but not with pure Java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic