net-long

function

Library: Network utilities (OMNETUTL legacy)
Include: omnetutl.xin

Declaration
net-long


Purpose

Use net-long to match a single long network number in a stream of bytes/octets.

Example

The following program takes a string consisting of three network order numbers and matches them individually. The output (on Windows) is two numbers that are the same (the first two numbers), followed one number that is different (the third number). They are output in host order.


  include "omnetutl.xin"
  
  process
     local stream network-bytes initial { "%1#%2#%3#%4#%1#%2#%3#%4#%4#%3#%3#%4#" }
     local integer host-long
  
     repeat scan network-bytes
        match net-long => x
           set host-long to from-net-long (x)
           output "d" % host-long || " "
     again
     output "%n"