The app running on the PC will be a server rather than a client, if the phone connects to it.
It will not be easy to send keyboard events from a Java application (though that might be possible), doing a simple server in C or C++ is probably easier (I assume your PC is windows based). Win32 API has a SendInput method to generate a keyboard event (example: http://batchloaf.wordpress.com/2012/04/17/simulating-a-keystroke-in-win32-c-or-c-using-sendinput/).
The communication between the android app and the PC can rely on a simple TCP socket (UDP is also a valid option but if you begin in network programming TCP is probably easier to handle and more widely used). On the C/C++ server, look at the functions socket, bind, listen, accept and then recv. On the android app, Socket and DataOutputStream classes should do the job.