Re: [Asterisk-java-devel] Regarding accept() call IOException
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2006-08-11 09:04:29
|
Hi, Shivram u wrote: > How does java work in the statement > while ((socket =3D serverSocket.accept()) !=3D null) >=20 > I assume that it throw an exception and gets handled by the exception > handler. rather than hitting the check for socket being null. You are right, the null check is not needed here. I'll change it for 0.3.= > If my assumption is correct, we hit the catch and then the finally > statement where we close the server socket. correct - at least we try closing the serversocket. > But shouldnt we just wait for the next client connection when the accep= t > call fails If the server socket has a problem that is usually due to something as severe as the socket being shutdown. I doubt it is usefull to try to reuse it after it threw an exception. If there are IOExceptions on the client sockets (i.e. client just connects and disconnects) we already do continue with the next client. Did you encounter any problems with the code? =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |