Cesario Simoes said:
I´m programming with Visual C++ since 1995. I have
developed many client and server Windows applications
using sockets and MFC. Now I need a Console Application
to convert in a NT service and I´m sliding: I wrote a
serverapplication and it accept connection from the cliente
but, when it try to send data, send returns always -1...
Someone may help me pointing to a sample code with
this kind of implementation?
It is hard to give an open-ended question like this anything more than a
general answer. Once you get to the point where you know what it is that
fails and how it fails you may want to post a short snippet of code that
exhibits a problem.
Until then, note that services (usually) run in a different security and
(usually) run on a different desktop. That can be the cause of problems.
I suggest that you take a look at the console-mode simple TCP/IP client
server sample in the Platform SDK named "simple" at the sub-directory
Samples\netds\WinSock\simple
Also take a look at the shell of a service at
Samples\winbase\Service
It is a simple service which uses a named pipe to handle client requests.
There are other samples and I think that there is an ATL service wizard in
some versions of VC.
Your mission is to marry the two samples. <g>
Regards,
Will