Giter Club home page Giter Club logo

dis_tutorial_multicast_example's Introduction

DIS_Tutorial_Multicast_Example

Simple Java program that shows sending and receiving DIS binary data with a multicast project.

Also provided as a example repository for wiki servers.

The application demonstrates what's involved in sending UDP multicast messages. In this case one thread sends PDUs, while another threat in the same application receives them. It uses the open-dis open source java project for DIS Protocol Data Units (PDUs).

On the sending side the open-dis project converts the java object corresponding to an Entity State PDU in DIS into the approved IEEE 1278.1 DIS binary format. It then sends that byte array to the network.

If you have the utility WireShark (http://www.wireshark.org) you can detect the DIS PDUs sent on the network. Wireshark includes a DIS binary interpreter, and you can see the entire content of the PDU.

Be aware that the Cisco AnyConnect remote access application causes endless problems with network identificatons. If on, turn it off, and restart.

The receiving thread receives the message and decodes it in two ways. Every PDU starts with the same three fields. We can decode those fields ourselves, or use open-DIS to decode the entire PDU. We first decode the fiels manually:

  ByteArrayInputStream bais = new ByteArrayInputStream(packet.getData());
  DataInputStream dis = new DataInputStream(bais);
  int disProtocolVersion = dis.readByte();
  int exerciseIdentifier = dis.readByte();
  int pduType = dis.readByte();

The puyrpose of the fields are discussed later. The "exerciseIdentifier" is between 0-255 and is different, due to a random number selection, every time it is run.

The other technique is to use open-dis, which can decode hundreds of fields. The code looks like this:

  PduFactory pduFactory = new PduFactory();
  ...
  Pdu aPdu = pduFactory.createPdu(packet.getData());
                
  disProtocolVersion = aPdu.getProtocolVersion();
  exerciseIdentifier = aPdu.getExerciseID();
  pduType = aPdu.getPduType();

This will interpret the data in the binary data the same way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.