Page 1 of 1
About Question enthuware.ocejws.v6.2.205 :
Posted: Wed Apr 09, 2014 2:15 pm
by himaiMinh
For the sake of discussion, I initially thought connection.connect() is considered as a set up method.
Because I thought without connect(), the client won't receive any input.
But I found an example from a book, which doesn't even need this method.
The openConnection() will connect to the service.
However, I think disconnect() is necessary as the end of the client's application.
Re: About Question enthuware.ocejws.v6.2.205 :
Posted: Thu Apr 10, 2014 2:22 pm
by fjwalraven
To clean up the resources nicely, yes.
Re: About Question enthuware.ocejws.v6.2.205 :
Posted: Thu May 07, 2015 9:46 am
by mameko
Hi,
I saw this in API:
It should be noted that a URLConnection instance does not establish the actual network connection on creation. This will happen only when calling URLConnection.connect().
So do we need the connect() method or not ?
Thanks,
Re: About Question enthuware.ocejws.v6.2.205 :
Posted: Thu May 07, 2015 2:42 pm
by fjwalraven
Hi
Yes, you are right this is written in the API. However you can also deduct from the following phrase that it is not always necessary:
In general, creating a connection to a URL is a multistep process
All examples I have seen so far (and all my code snippets) can do without the explicit call to the connect method.
Regards,
Frits
Re: About Question enthuware.ocejws.v6.2.205 :
Posted: Thu Nov 05, 2015 10:21 am
by ramy6_1
Hello ,
I believe the answers will be clearer if you removed connection.connect(); from the available options.
It is confusing beside "This is not a setup method."
For me it can be correct answer in the subject context.
Re: About Question enthuware.ocejws.v6.2.205 :
Posted: Fri Nov 06, 2015 12:44 am
by fjwalraven
Hi,
I agree it can make you confused. I will change this option.
Thanks for your feedback!
Regards,
Frits