aspose file tools*
The moose likes Java in General and the fly likes udp port listening : where to start? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "udp port listening : where to start?" Watch "udp port listening : where to start?" New topic
Author

udp port listening : where to start?

Phillip Kuon
Greenhorn

Joined: Feb 28, 2010
Posts: 3
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

Joined: Dec 16, 2008
Posts: 42
Hi,

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

Thanks
Shan
Phillip Kuon
Greenhorn

Joined: Feb 28, 2010
Posts: 3
is there a way to output which service is occupying that port?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Probably with JNI (CurrPorts can do it), but not with pure Java.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: udp port listening : where to start?