in reply to Terminal Client

Is not the builtin chr for that?
$MySocket->send(chr(0x02));