This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

check if a UDP port is busy  RSS feed

 
Deepak Saini
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
before i create a socket at a udp port, i need to check if it is already in use. Any idea how to do it..
 
Mallick Choppa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Java doesn't provide that type of API (Correct me if I am Wrong). But i would say try to open the datagram Socket within a Try Catch block and catch for Bind exception then you can implement what ever is your requirement.
hope this helps
Mallick
mallick@orillion.stph.net
 
Mallick Choppa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
JDK1.4 provids an API to check whether the socket is bound or not.
I didn't use this but it may be worth checking it.
Mallick
mallick@orillion.stph.net
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!