Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Socket waiting for server

Reply
Thread Tools

Re: Socket waiting for server

 
 
Steve Horsley
Guest
Posts: n/a
 
      07-30-2003
On Wed, 30 Jul 2003 14:20:54 +0200, Arnaud Berger wrote:

> Hi everyone !
>
> I've got a java application on my machine, which is supposed to launch the
> "server" part (ServerSocket stuff) and also the "client" part (Socket) of
> my appli.
>
> I obviously encounter a java.net.ConnectException while the server part is
> not up (doing Socket sock=new Socket(myhost, myPort).
>
> The question is, is there a way for me to wait until the server is up and
> running ?
> the socket's connect(SocketAddress, timeout) method is of no help for this
> because the timeout is effective only when the connection has already
> succeeded.
>
> Thanks in advance for any pointer.
>
>
> Arnaud


The best that I can think of is to use a loop with a sleep if the
connection fails. Then perhaps rethrow the caught exception if it is still
failing after a period of time.

Steve
 
Reply With Quote
 
 
 
 
Arnaud Berger
Guest
Posts: n/a
 
      07-30-2003
Thanks everyone

Arnaud

"Steve Horsley" <(E-Mail Removed)_SPAM.net> a écrit dans le message
news: http://www.velocityreviews.com/forums/(E-Mail Removed)_SPAM.net...
> On Wed, 30 Jul 2003 14:20:54 +0200, Arnaud Berger wrote:
>
> > Hi everyone !
> >
> > I've got a java application on my machine, which is supposed to launch

the
> > "server" part (ServerSocket stuff) and also the "client" part (Socket)

of
> > my appli.
> >
> > I obviously encounter a java.net.ConnectException while the server part

is
> > not up (doing Socket sock=new Socket(myhost, myPort).
> >
> > The question is, is there a way for me to wait until the server is up

and
> > running ?
> > the socket's connect(SocketAddress, timeout) method is of no help for

this
> > because the timeout is effective only when the connection has already
> > succeeded.
> >
> > Thanks in advance for any pointer.
> >
> >
> > Arnaud

>
> The best that I can think of is to use a loop with a sleep if the
> connection fails. Then perhaps rethrow the caught exception if it is still
> failing after a period of time.
>
> Steve



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Steve Holden Python 0 02-01-2009 12:45 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 0 02-01-2009 07:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM
Re: Socket waiting for server EJP Java 1 08-01-2003 09:30 AM



Advertisments