I'm trying to create a simple server/client using netcat on a windows box. I'm binding netcat to a port and a custom console based application that I am writing in Borland C++ on a Windows 2000 Machine. All the custom app does is read in some information, and then execute a command on the local system, reporting the results to standard output.
When I run the application through the command line it works perfectly. However, when I run the application with netcat (I'm connecting to it through a port) it halts when executing the system call.
I've tried a few different ways to execute the system call and return the results :
1) _popen() the command : this is the obvious choice, which simply did not work. I read that it may return an invalid file handle.
2) system() the command : should redirect the output to stdout, but I figured it may switch process control confusing netcat.
3) system() the command redirected to a file, then read the file and display it to standard output : this is a little bit out of the way, but if it works I'd use it.
All of the above work when running the command locally (and some even work on ONE of my machines). However, they all fail on the machine that I need it to run when running it over netcat...
Has anyone ever experienced this before?