Solved

Doing nothing

Posted on 2004-09-12
4
248 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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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