You'll have to kill the process. Look for your program running in the task manager or process manager and end the process. (ctrl-alt-del task manager in windows or ps in linux)

Post your samba config file.

Is the older technology ps/2? So you're using a ps/2-to-USB adapter? What operating system is running on the PC?

What are you passing in for "count"? ... Also, if you could use the code tags in the future([CODE][/CODE]), it would be much easier for us to read your code.

"Translating" into languages isn't the easiest of tasks, especially C# into C. C# is .net based on OOD whereas C is a functional language.. Even C++ isn't true OOD. I'd suggest reading up on how to create C++ classes and translate this code into C++.

"sock = servSock.accept();"

... That's a blocking call. Your coding is awaiting someone to connect on port 9999. Telnet to that port and your code will continue. (telnet 9999)