We help IT Professionals succeed at work.

Problem w/ system/popen and netcat..

smisk
smisk asked
on
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?

Thanks,
Steve
Comment
Watch Question

Commented:
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to refund the points and delete this question since nobody had an answer for you.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner

Author

Commented:
This situation was resolved.  I made an rexec call to a linux box and wrote the thing in C for Linux (using popen() if anyone is interested).

I'm not much of a windows programmer.
Points refunded and question closed by
Netminder
CS Moderator