Skip to content

demo hang  #269

@nlphacker

Description

@nlphacker

Try to call http in C#. but it hangs at the below line

      var result = await createHttpServer(9999);  

full code is below

 static async void TestHttp()
    {
        var createHttpServer = Edge.Func(@"
            var http = require('http');

            return function (port, cb) {

            var server = http.createServer(function (req, res) {
                    res.end('Hello, world! ' + new Date());
                }).listen(port, cb);

               // cb(null, 'Node.js welcomes'); 
            };
        ");

        var result = await createHttpServer(9999);
        Console.WriteLine("done");
        Console.WriteLine(await new WebClient().DownloadStringTaskAsync("http://localhost:9999"));
    }




    static void Main(string[] args)
    {
        // Task.Run((Action)Start).Wait(); 

        Task.Run((Action)TestHttp).Wait();
        new ManualResetEvent(false).WaitOne();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions