Solved

Doing nothing

Posted on 2004-09-12
4
245 Views
Last Modified: 2010-04-15
Ola,

I have this remoting setup theory. An HTTPhandler stored the HTTPcontext in an other app acting as a server. The HTTPhandler does so via the use of remoting. This is all theory for now and would like to know if that wold be at all possible.
If possible then how could i have my server do nothing but wait for incomming HTTPcontext's. looping in CPU intensive and blocking so not an option.

Please add upon the provided server code ( HTTPhandler and remoting object code are not important now )
using System.Web;
using System.Collections;

using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class CSdhtmlChatServer
{
      public static ArrayList prArrayListHTTPcontext = new ArrayList);

    public static void Main(string [] args)
    {
        ChannelServices.RegisterChannel( new TcpChannel( 8080 ) );
       
            RemotingConfiguration.RegisterWellKnownServiceType(
            typeof( CSDHTMLchatRemotingObject ),
            "CSDHTMLchatRemotingObject",
            WellKnownObjectMode.Singleton
        );

        CSDHTMLchatRemotingObject.CSDHTMLchatInterfaceImplementation = new CSDHTMLchatInterfaceObject();
        // How do I do nothing without stoping the server.
        // And the doing nothing should not be blocking because when ever an HTTPcontext arives in the HTTPhandler
        // it should be stored imediately and additional code should be excecuted.
    }
}

public class CSDHTMLchatInterfaceObject : CSDHTMLchatInterface
{
     public void StoreHTTPcontext( HttpContext iHTTPcontent )
     {
            CSdhtmlChatServer.prArrayListHTTPcontext.Add( iHTTPcontent );
            // do other things
     }

}
0
Comment
Question by:DaFou
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
smegghead earned 500 total points
ID: 12037658
If this is a console application, you can do something like

Console.ReadLine();

Which will keep it running until you press return.

0
 
LVL 2

Author Comment

by:DaFou
ID: 12037688
ok, that is not really an option. and what if the server is a windows service?
0
 
LVL 10

Expert Comment

by:smegghead
ID: 12037710
The service will remain active until a 'Stop' request is received.
0
 
LVL 2

Author Comment

by:DaFou
ID: 12037717
ok wicked. but then again. reading the command line is not an option becuase is someone acidently hits enter then it is ****ed.

perhaps this will do it.

while ( ( ! ( Console.ReadLine( ) == "This never gets typed by accident" ) ) )
{
  // do nothing
}
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now