serial on Mac & Windows

I have a problem to get a serial port read on windows while it works on Mac.
I initialize as follows:
W_serial.Serial1.SerialPort = system.serialport(rng_portnumber) ‘ i detected the port number by looking at the names
W_serial.Serial1.DTR=false
W_serial.Serial1.Baud=W_serial.Serial1.Baud9600 // or 2
W_serial.Serial1.Parity=W_serial.Serial1.ParityNone // or 0
W_serial.Serial1.Bits=3 //8 bits. //
W_serial.Serial1.Stop=W_serial.Serial1.StopBits15 //or 1

then when needed I switch on the port with:
dim status as Boolean
status = W_serial.Serial1.open
W_serial.Serial1.DTR= true

and start polling the port:
while data_available_flag =false
W_serial.Serial1.poll
wend
with the dataavailable event reading the port:
data_available_flag=false
serial1.DTR =False 'don’t ask further data
true_rbyte = serial1.read(8)

This works fine but not on windows. However the following works on windows (showing some superiority of matlab?)
rng = serial(‘COM7’);
fopen(rng);
random_byte = fread(rng, 1);

Note that the COM7 port is associated with the port number I use in the XOJO code.

Who has any idea what I am doing incorrectly?

Any time you change the line state (or other properties) while the port is open, you must call Reset.

http://documentation.xojo.com/index.php/Serial.Reset