Solved

Doing nothing

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

786 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