Hi there, i am trying to create multiple clients connecting to the server.
But the problem is that I can't set the Socket() constructor time.i.e by default the constructor waits to listen for 20 sec. My clients are many so that the time taking for those is hi. So that any one can help me please. I want to set the time to minimum sec before the client is created.

Recommended Answers

All 3 Replies

You don't set the timeout in the constructor, it's an optional parameter on the connect(...) method.

yea, to Socket.connect(SocketAddress sa, int timeout); method we can tell send time; but the SocketAddress is null before the socket is createde. Did i make a mistake?

Please tell me in example.

thanks.

Are we taking about the server socket or the client socket here?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.