>Looking for experienced advice re port listeners.
>
>We have customers whose Cloverleaf system relies on ports to communicate data messages to other systems, including ours.
>
>We have a small VFP app that uses Winsock to listen to the port. We used VFP because this thing may have to run on really old machines and it's great to be able to copy VFP exe and runtimes to a machine where you can be confident it will work immediately.
>
>When the app receives a message via the port, the app saves it into a folder and signals success. That's all it needs to do.
>
>Problem is that this port listener exe freezes. Then messages are dropped and we're in limbo until somebody notices and restarts it, at which point it runs fine until the next freeze.
>
>Does anybody have experience with port listening, e.g. via some other mechanism more reliable than Winsock?
Winsock, properly used is reliable. This would be simple enough in .Net using either the Socket class which wraps Winsock or, in your case, maybe the higher level TcpClient class which is simpler to implement. In either case running within a windows service is also straightforward.
http://msdn.microsoft.com/en-us/library/system.net.sockets.socket(v=vs.110).aspxhttp://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient(v=vs.110).aspxhttp://msdn.microsoft.com/en-us/library/aa983583(v=vs.71).aspxThere's an old example here :
http://www.codeproject.com/Articles/5733/A-TCP-IP-Server-written-in-CIn that instance the server is running as a service and receiving files from the client but the principle remains the same.....
HTH
>
>Also, as a related matter- ideally this app would run as a service so that if it fails it can shut down and be restarted automatically by Service Manager. But the developer says this does not happen, apparently because VFP lacks the "hooks" needed by Service Manager to oversee service availability. If the exe crashes or shuts down, apparently Service Manager thinks it's still working fine. I have reviewed Calvin's blogs and other material on this and see no reference to this issue. Is it true- IOW if a VFP service freezes or crashes out, does it really not get restarted by Service Manager? If so, does anybody have a better solution to work with port listening, or even if you confirm that you have VFP services doing other stuff under expected Service Manager control, iow restarting if required, that would be a great help.