as I said: F1 key does not have an ASCII code.
so, you have to define some other ascii code combination to represent F1, aka the receiving side of the data stream has to look for this and say: this is F1 ...
for example:
sending "{F1}" is to be understood as "F1", while sending "{{}" shall be read on the receiving side as "{"