How can I easily convert legacy code to WCF?

Hi I have the following legacy code. I would like to create a WCF without going to create all the contracts and other junk MS has built into their code. There are more then 100 commands I would have to create for every method and command. It would be simpler just to use the existing code.

 using System;
 using System.Net.Sockets;

 namespace Server
 {
class Program
{
    static void Main(string[] args)
    {
        TcpListener serverSocket = new TcpListener(55555);
        TcpClient clientSocket = default(TcpClient);
        serverSocket.Start();
        Console.WriteLine(" >> " + "Server Started");
        ServerLobby.Initialize();
        ServerLobby.reader.Load("Users.xml");

        while (true)
        {
            clientSocket = serverSocket.AcceptTcpClient();
            Client client = new Client(clientSocket);
          }
       }
    }
}

Thanks

Answers


The simplest way would be to define a simple WCF interface that will call your legacy methods. You still gotta fill in all that "junk" though.

public interface ICommandServer
{
    void Execute(string command, string[] args);
}

Need Your Help

Is it possible to use Jambi to make fully native feeling GUIs?

java qt cross-platform desktop-application qt-jambi

Applications made with Qt in C++ look like native apps on Windows, Linux, and Mac OS X. I'm trying to accomplish the same thing with Jambi. Is this possible? I don't think there are too many apps w...

Apache Tomcat startup does not find neither JDK or JRE

java jsp tomcat environment-variables windows-8.1

I need Apache Tomcat to run jsp projects in Eclipse on Windows 8.1 (64 bits).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.