Windows Service sending data to a java app through Sockets?

I was wondering is this idea possible? When i try it it aint working for me at the moment but when i try it with a C# console application it works.. so something is missing somewhere.

I know the windows service is functioning properly as i managed to get it to write to a file but perhaps its the socket codes.

If my idea does not work or can anybody suggests a better alternative for having a Windows Service to communicate with a Java App apart from using network sockets? I prefer not to go down the JNI route if it can be avoided..