Solved

Doing nothing

Posted on 2004-09-12
4
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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