To test the TCP listening application, you obviously need to write TCP transferring one. You can write it and:
- Run them simultaneously
OR
- Run listener on your OS and transmitter in virtual machine. I made so and has written a post on my blog on Russian (sources are also available for download).