i search in google and board serach but I don't find really help for my problem

my circuit:
pin 3(send) --- diode --- pin 2(receive)

an easy circuit

the diode shines every time, because the seriel interface has in the low time an 1 signal. but i want to have an 0 signal, that the diode doesn't shine.

my code:
int character = 0;
outport(0x3f8, 1);
character = inport(0x3f8);
cout << charcter;
but character = 0 and the diode shines

when someone has an other solution for linux, i like the solution too.

thanks for help