Im making multiplayer snake game in terminal in go and i do not know how to pass param and keep listening to keys pressed in terminal.
I can use:
- echo “?id” | nc 0.0.0.0 3000 -> will pass parameter to server
- stty raw; nc 0.0.0.0 3000 -> listen pressed keys without entering them
I tried different combinations of this two but i cannot achieve desired results.
So i need to pass param in format “<?+>msg” (1st byte determine command) to server and then pass to server key (wasdq) pressed in terminal. Is it possible to combine commands which i described above?