}
if (port == 0)
port = 80;
SocketInputOutput stream;
if ("udp".equals(protocol))
stream = new UdpInputOutput(env, host, port, Domain.AF_INET);
else {
boolean isSecure = "ssl".equals(protocol);
stream = new TcpInputOutput(env, host, port, isSecure, Domain.AF_INET);
}
if (timeout > 0)
stream.setTimeout((int) (timeout * 1000));
else
stream.setTimeout(120000);
stream.init();
return stream;
} catch (IOException e) {
log.log(Level.FINER, e.toString(), e);