Forums Register Login

Help me !! creat socket!

+Pie Number of slices to send: Send
i use jsse/ssl socket!
when i use
socket = (SSLSocket)factory.createSocket(host, port);
if i give a exists host and not used port!
i will wait for more than 10 minute!!!
how can i set timeout, when creatSocket???
+Pie Number of slices to send: Send
Hi,
You can specify the timeout via invoking the method setSoTimeout(int timeOut), once you create the socket. This functionality is inherited from the java.net.Socket.
+Pie Number of slices to send: Send
An additional bit of information:- the trick is first to create an unconnected Socket with the no-arg factory method and only then to connect it using connect(SocketAddress, timeout).
- Peter
+Pie Number of slices to send: Send
creatSocket(host,port)
only this method will spend more than 10 minute when host exist but port not!!
who can help me set timeout when only when
creatSocket!!!
and i know socket.setTimeOut(),but this method
can do only socket is connectted!!!
+Pie Number of slices to send: Send
Hi Allan,
You can try what Peter was saying, first create an unconnected socket and then specify the timeout while connecting.
The connect method throws a SocketTimeoutException - if the timeout expires before connecting. There is no need for you to wait for 10 mins.
Specifying the timeout at socket creation is not available. I am not aware why they have not specified the timeout value at creation time.
+Pie Number of slices to send: Send
i use jsse-1_0_3_01-gl!
SocketFactory can not create an unconnected socket !
what can i do?
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 909 times.
Similar Threads
Sockets vs URL Based classes
Client Failed to connect, how do I attempt a reconnect?
Address already in use
Plain socket to SSL
socket programming on 2 ports
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:18:09.