UDP Socket Connection

0 votes
asked Jul 28, 2018 by (150 points)
Our connections with our clients only allow UDP traffic. I only see posts mentioning TCP in the forum, is UDP supported (even through an extension or customization)? Thank you.

2 Answers

0 votes
Best answer

I found a UDP listener and sender example.  It has some specific ATNA Logging details, which would need to be modified for your purposes.  In a source node, use a Script, and set the Custom Script:

var socket;
try {
   // create UDP Listener
   socket = new;'socket opened: 6701');
   // start reciever thread
   var receiverThread = new java.lang.Thread(new java.lang.Runnable() {
      run: function() {
         com.qvera.qie.persistence.ThreadContext.setUser('sys');'receiver thread started');
         try {
            while (qie.isChannelRunning()) {
               // create 4K buffer
               var buf = new, 4096);
               // create receive packet
               var packet = new, buf.length);
               // receive the data
               // extract the data
               var data = new java.lang.String(packet.getData(), 0, packet.getLength(), "UTF-8");
     'data received: ' + data);
               // add to inbound queue
               var auditMessage = data.substring(data.indexOf('<AuditMessage'));
               qie.addInboundMessage(auditMessage, null);
         } catch (err) {
  'receiver thread error: ' + err);
         }'receiver thread stopped');
   // loop until channel is stopped
   while (qie.isChannelRunning()) {
      try {
      } catch (err) {
         qie.debug("Early wake-up call received.");
} finally {
   socket.close();'socket closed: 6701');

In order to send to UDP message, you can use the following script:

var clientSocket = new;
var IPAddress ="destinationHost");
var sendPacket = new, message.getBytes().length, IPAddress, 6701);

It should be noted that UDP does not provide delivery confirmation, and therefore will likely drop packets and neither system will know about it.  UDP should not be used with critical data.

answered Jul 31, 2018 by mike-r-7535 (13,830 points)
0 votes
Currently QIE has no native support for UDP. We may have a third party jar that may enable it. UDP is not reliable and is not recommended.

Please email us @ to discuss further.
answered Jul 30, 2018 by brandon-w-8204 (33,330 points)