Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4097082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:07:41+00:00 2026-05-20T20:07:41+00:00

I need to write a program that will communicate with other .NET programs …

  • 0

I need to write a program that will communicate with other .NET programs … but also a legacy VFP program over TCP. I need to choose a fairly simple TCP message format that the VFP programmer can use. It could be as simple as a sequence of small XML blobs delimited by… I dunno, a null character? Whatever.

I need to choose between TcpListener/TcpClient and WCF. I started researching WCF but its architecture seems opaque and built-in Visual Studio templates are heavily biased toward making “web services” that act like a sort of RPC mechanism, but require a special “host” or web server that is external to the application. And Microsoft’s 6-stage tutorial makes WCF sound pretty cumbersome (involving code generators, command-line and XML crap just to remotely subtract or multiply two numbers).

I want a self-contained app (no “host”), I want control of the wire protocol, and I want to understand how it works. WCF doesn’t seem to facilitate these things, so I abandoned it in factor of TcpListener/TcpClient.

However, the program is to serve as an intermediary between a single (VFP) server and many (.NET) clients, and there will be communication in both directions and across different connections. Using TcpListener and TcpClient, the work of juggling the connections and threads is getting a bit messy, I have no experience with IAsyncResult, and I’m not just not confident in my code quality.

So I would like to solicit opinions again: should I still consider WCF instead? If yes, can you point me toward answers to the following questions?

  1. Where in the web is a good explanation of WCF’s architecture? Or do I need a book?
  2. How is bi-directional communication done in WCF, where either side (of a single TCP connection) can send a message at any time?
  3. How can I get past all the web-services and RPC mumbo-jumbo, and control the wire protocol?
  4. In WCF, how do I shut down the app cleanly, closing all connections in parallel without hacky Thread.Abort() commands?

If no, how can I set up my code (that uses TcpListener/TcpClient/NetworkStream) so that I can read a message from a NetworkStream, but also accept requests from other connections, shut down cleanly at any time, and avoid wasting CPU time to poll queues and NetworkStreams that are inactive?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:07:41+00:00Added an answer on May 20, 2026 at 8:07 pm

    The short answer: go with WCF. While there’s a good amount of tooling and code-generation and other bells and whistles around it, there’s nothing that is preventing you from setting up everything in code (you can define your contracts, set the endpoints up, etc. all in code).

    For your specific questions:

    1. WCF Architecture – This is pretty basic, and it should get you up and running relatively quickly.
    2. What you are looking for is duplex services. The NetTcpBinding allows for duplex services out-of-the-box (although you can do it with HTTP, you need a specific binding).
    3. If you want to control the wire format, you will want to create a custom encoder. However, I have to strongly recommend against it. You want to create an XML file with null character to delineate separate messages? There’s no need for that, the nature of XML is that you can create child elements to perform the appropriate grouping; there’s no limit to how many elements you can nest. There’s really no need for this.
    4. Simply shutting down the ServiceHost by calling Close, this will allow all outstanding requests to complete, and then shut down gracefully. If you really want to tear down without concern, then call Abort.

    In the end, I’d strongly recommend that you not use the NetTcpBinding; VFP will have a difficult time consuming the protocol. However, if you use an HTTP-based protocol, there are always tools that VFP can easily use to make the call and consume the contents (assuming you stick with XML).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a C program that will allow me to read/write files
I need to write a program that will take a existing local windows user,
Hey, I need to write a program for OSX that will cause my macbook
I need to write a server program that will open and keep 5 live
I need to write a delegate for a multi-threaded program that will enable/disable a
I need to write a C program that will compare the number of digits
I need to write a program, that will ask a user to enter a
I need to write program that will be given some path as a parameter,
I need to write a program that will generate 108 combinaisons of icons (standard
I need to write a javascript program that will ask the user to enter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.