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

Question regarding exception handling... java.net.ConnectException  RSS feed

 
Dalton Curtin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off Howdy,
student of programming working on an assignment. It's a messenger that sends packets to a server which in turn sends packets to a multicast distributor. Right now I'm trying to tidy up the gui elements and want to add an exception handle for when the teacher decides to put nothing or rubbish as the ip address. I understand this exception that's being thrown but for some reason i can't get my head around how to wrap it up in a proper try catch block.

feel welcome to slap my head if this has come up before around here, but honestly I couldn't find anything regarding the setting up of the exception, Just what the exception meant.
 
Stephan van Hulst
Saloon Keeper
Posts: 7817
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dalton, welcome to CodeRanch!

I'm not sure what problem you are having. Do you understand how try-catch statements work? If so, what's stopping you from catching this particular exception?
 
Dalton Curtin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey sir,
Thank you for the quick response... I found out, everything of my try-catch block was correct except the placement. Have been working on this with no sleep so silly mistakes were bound to be made xD Feel like this assignment has been playing tricks on me from the get-go anyhow... that multicasting can be tricky
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!