netcat
is basically something that either accepts (when acting as server) or opens (when acting as client) a socket. Anything typed into stdin
is written to the socket. Anything read from the socket is written to stdout
. Any errors are written to stderr
.
That's the basics. It looks like you are using it on Windows and attaching the standard IO to a command shell. I'm not sure why/what this does for you, so I'm going to ignore that for now.
Anyway, what you need to do is write an app that accepts/opens a socket, write to ... etc... (see paragraph 1).
There is a lot of stuff online that explains how to do this. The ultimate answer to your question depends on why you want to do this (i.e. why not just use netcat
), whether you want a nice POSIX compliant app that would build on any platform or something that is Windows only (and maybe uses Windows UI components), and other considerations.
I recommend you start by searching Google for something like socket programming in c, socket programming in c++, or Windows socket programming.