private void test() { boolean testOK = false; String errMsg = null; String hostname = transMeta.environmentSubstitute( wServerName.getText() ); int nrPort = Const.toInt( transMeta.environmentSubstitute( "" + wPort.getText() ), SyslogDefs.DEFAULT_PORT ); try { UdpAddress udpAddress = new UdpAddress( InetAddress.getByName( hostname ), nrPort ); UserTarget usertarget = new UserTarget(); usertarget.setAddress( udpAddress ); testOK = usertarget.getAddress().isValid(); if ( !testOK ) { errMsg = BaseMessages.getString( PKG, "SyslogMessageDialog.CanNotGetAddress", hostname ); } } catch ( Exception e ) { errMsg = e.getMessage(); } if ( testOK ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "SyslogMessageDialog.Connected.OK", hostname ) + Const.CR ); mb.setText( BaseMessages.getString( PKG, "SyslogMessageDialog.Connected.Title.Ok" ) ); mb.open(); } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "SyslogMessageDialog.Connected.NOK.ConnectionBad", hostname ) + Const.CR + errMsg + Const.CR ); mb.setText( BaseMessages.getString( PKG, "SyslogMessageDialog.Connected.Title.Bad" ) ); mb.open(); } }
public DtlsAddress(UdpAddress udpAddress) { super(udpAddress.getInetAddress(), udpAddress.getPort()); }
public static Address parse(String address) { UdpAddress a = new UdpAddress(); if (a.parseAddress(address)) { return a; } return null; }
/** * Creates a UDP transport with an arbitrary local port on all local * interfaces. * * @throws IOException * if socket binding fails. */ public DefaultUdpTransportMapping() throws IOException { super(new UdpAddress("0.0.0.0/0")); socket = new DatagramSocket(udpAddress.getPort()); }
/** {@inheritDoc} */ @Override protected void addNotificationTargets(SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB) { targetMIB.addDefaultTDomains(); targetMIB.addTargetAddress(new OctetString("notification"), TransportDomains.transportDomainUdpIpv4, new OctetString(new UdpAddress("127.0.0.1/162").getValue()), 200, 1, new OctetString("notify"), new OctetString("v2c"), StorageType.permanent); targetMIB.addTargetParams(new OctetString("v2c"), MessageProcessingModel.MPv2c, SecurityModel.SECURITY_MODEL_SNMPv2c, new OctetString("public"), SecurityLevel.NOAUTH_NOPRIV, StorageType.permanent); notificationMIB.addNotifyEntry(new OctetString("default"), new OctetString("notify"), SnmpNotificationMIB.SnmpNotifyTypeEnum.trap, StorageType.permanent); }
udpAddress.getInetAddress(), udpAddress.getPort()); try { try { bis = ByteBuffer.wrap(packet.getData()); fireProcessMessage(new UdpAddress(packet.getAddress(), packet.getPort()), bis);
private synchronized DatagramSocket ensureSocket() throws SocketException { DatagramSocket s = socket; if (s == null) { s = new DatagramSocket(udpAddress.getPort()); s.setSoTimeout(socketTimeout); this.socket = s; } return s; }
public UdpAddress(String address) { if (!parseAddress(address)) { throw new IllegalArgumentException(address); } }
new OctetString(new UdpAddress("127.0.0.1/162").getValue()), 200, 1, new OctetString("notify"), targetMIB.addTargetAddress(new OctetString("notificationV3"), TransportDomains.transportDomainUdpIpv4, new OctetString(new UdpAddress("127.0.0.1/1162").getValue()), 200, 1, new OctetString("notify"),
udpAddress.getInetAddress(), udpAddress.getPort()); try { socketCopy = socket; SecurityLevel.undefined, SecurityLevel.undefined, false, socketCopy); fireProcessMessage(new UdpAddress(packet.getAddress(), packet.getPort()), bis, stateReference);
/** * Creates a UDP transport with an arbitrary local port on all local * interfaces. * * @throws SocketException * if socket binding fails. */ public DefaultUdpTransportMapping() throws SocketException { super(new UdpAddress("0.0.0.0/0")); socket = new DatagramSocket(udpAddress.getPort()); }
protected synchronized DatagramSocket ensureSocket() throws SocketException { DatagramSocket s = socket; if (s == null) { s = new DatagramSocket(udpAddress.getPort()); s.setSoTimeout(socketTimeout); this.socket = s; } return s; }
public UdpAddress(String address) { if (!parseAddress(address)) { throw new IllegalArgumentException(address); } }
private void test() { boolean testOK = false; String errMsg = null; String hostname = jobMeta.environmentSubstitute( wServerName.getText() ); int nrPort = Const.toInt( jobMeta.environmentSubstitute( "" + wPort.getText() ), SyslogDefs.DEFAULT_PORT ); try { UdpAddress udpAddress = new UdpAddress( InetAddress.getByName( hostname ), nrPort ); UserTarget usertarget = new UserTarget(); usertarget.setAddress( udpAddress ); testOK = usertarget.getAddress().isValid(); if ( !testOK ) { errMsg = BaseMessages.getString( PKG, "JobEntrySyslog.CanNotGetAddress", hostname ); } } catch ( Exception e ) { errMsg = e.getMessage(); } if ( testOK ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "JobEntrySyslog.Connected.OK", hostname ) + Const.CR ); mb.setText( BaseMessages.getString( PKG, "JobEntrySyslog.Connected.Title.Ok" ) ); mb.open(); } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "JobEntrySyslog.Connected.NOK.ConnectionBad", hostname ) + Const.CR + errMsg + Const.CR ); mb.setText( BaseMessages.getString( PKG, "JobEntrySyslog.Connected.Title.Bad" ) ); mb.open(); } }
public static Address parse(String address) { try { UdpAddress a = new UdpAddress(); if (a.parseAddress(address)) { return a; } } catch (Exception ex) { } return null; }
/** {@inheritDoc} */ @Override protected void addNotificationTargets(SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB) { targetMIB.addDefaultTDomains(); targetMIB.addTargetAddress(new OctetString("notification"), TransportDomains.transportDomainUdpIpv4, new OctetString(new UdpAddress("127.0.0.1/162").getValue()), 200, 1, new OctetString("notify"), new OctetString("v2c"), StorageType.permanent); targetMIB.addTargetParams(new OctetString("v2c"), MessageProcessingModel.MPv2c, SecurityModel.SECURITY_MODEL_SNMPv2c, new OctetString("public"), SecurityLevel.NOAUTH_NOPRIV, StorageType.permanent); notificationMIB.addNotifyEntry(new OctetString("default"), new OctetString("notify"), SnmpNotificationMIB.SnmpNotifyTypeEnum.trap, StorageType.permanent); }
logger.info("Listening on socket " + new UdpAddress(socketCopy.getLocalAddress(), socketCopy.getLocalPort())); udpAddress.getInetAddress(), udpAddress.getPort()); try { socketCopy = socket; fireProcessMessage(new UdpAddress(packet.getAddress(), packet.getPort()), bis, stateReference);
/** * Creates a UDP transport with an arbitrary local port on all local * interfaces. * * @throws IOException * if socket binding fails. */ public DefaultUdpTransportMapping() throws IOException { super(new UdpAddress(InetAddress.getLocalHost(), 0)); socket = new DatagramSocket(udpAddress.getPort()); }
/** * Creates a UDP transport on the specified address. The address will not be * reused if it is currently in timeout state (TIME_WAIT). * * @param udpAddress * the local address for sending and receiving of UDP messages. * @throws IOException * if socket binding fails. */ public DefaultUdpTransportMapping(UdpAddress udpAddress) throws IOException { super(udpAddress); socket = new DatagramSocket(udpAddress.getPort(), udpAddress.getInetAddress()); }
private synchronized DatagramSocket ensureSocket() throws SocketException { DatagramSocket s = socket; if (s == null) { s = new DatagramSocket(udpAddress.getPort()); s.setSoTimeout(socketTimeout); this.socket = s; } return s; }