← Back to team overview

rohc team mailing list archive

Re: [Question #228835]: the compressed result is not the same

 

Question #228835 on rohc changed:
https://answers.launchpad.net/rohc/+question/228835

    Status: Open => Answered

Didier Barvaux proposed the following answer:

Sorry, but your message is written in bad English. I'm not sure to understand it fully. I'll try to rephrase your question. Tell me if it matches what you were trying to say. For later questions/answers, please try to make shorter sentences.

> By using the src codes and other .c files for tests of rohc-1.5.1.tar.bz2 in
> Eclipse of Windows OS,I run the same logic as the simple_rohc_program.c
> with a real UDP/IP packet(opening the UDP profile) in cygwin, a compressed
> packet can be got.

You're using the Eclipse IDE on Windows/Cygwin to build the ROHC library
and a small test program. That test program is based on the
simple_rohc_program.c from the library. However it enables the UDP
profile, then compresses one IP/UDP packet. As a result, you got a ROHC
packet. Am I right?


> however, I run the same code in the Linux(Fedoral)OS with the same real
> UDP packet,the result packet has the same length each field,but is not
> the same value as the packet got in cygwin.is it right or wrong? or the
> random numbers generated by rand() in compression will make them different?

According to the ROHC standards, the initial Sequence Number (SN) for
the UDP profile shall be chosen randomly. The ROHC library does not
generate random numbers itself. This is done this way in order to be
portable on several different OS.

The simple_rohc_program program implements a callback for random numbers
and tells the ROHC library to use it. The random callback calls the
rand() function. The rand() function (when initialized correctly by the
srand() function) will give you a different result each time you start
your program.

If you want the same result, either replace the call to rand() by a
constant value or change the way srand() is called.

Regards,
Didier

-- 
You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.