🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #29495

Re: Time Out con Datagramas

#29495
From: Chano G�mez
Date: Wed, 17 Dec 1997 00:00
27 lines
1550 bytes
> Que hay que a�adir para que una vez recibido el paquete el hilo no
> mantenga la pausa ??? , una excepcion, que ??? desde luego es ideal
> para detectar si se ha recibido algo o no ...

La semantica del m�todo sleep() no es la que t� crees.

De todas formas, la soluci�n es m�s f�cil que todo el rollo ese de los
hilos. Mira el m�todo DatagramSocket.setSoTimeout() del JDK 1.1:

setSoTimeout

public synchronized void setSoTimeout(int timeout) throws SocketException

Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With
this option set to a non-zero timeout, a call to receive() for this
DatagramSocket will block for only this amount of time. If the timeout
expires, a java.io.InterruptedIOException is raised, though the ServerSocket

is still valid. The option must be enabled prior to entering the blocking
operation to have effect. The timeout must be > 0. A timeout of zero is
interpreted as an infinite timeout.


Un saludo.

Chano.
Technical Details
Message-ID: <349854D7.A711BA36@ran.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34954164.432D@sinix.net> <34958E78.D7770ECE@ran.es> <34964453.F44@sinix.net>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: 1116f3,f4c450d40b17ee79
X-Google-Attributes: gid1116f3,public
From: "Chano G�mez" <chano@ran.es>
Subject: Re: Time Out con Datagramas
Date: 1997/12/17
Message-ID: <349854D7.A711BA36@ran.es>
X-Deja-AN: 299152998
Content-Transfer-Encoding: 8bit
References: <34954164.432D@sinix.net> <34958E78.D7770ECE@ran.es> <34964453.F44@sinix.net>
Content-Type: text/plain; charset=iso-8859-1
Organization: Unisource Espana NEWS SERVER
Mime-Version: 1.0
Newsgroups: es.comp.lenguajes.java