Solved

Doing nothing

Posted on 2004-09-12
4
246 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

23 Experts available now in Live!

Get 1:1 Help Now