On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote:
On Friday, 18 October 2019 at 08:54:40 UTC, Jacob Carlborg wrote:
On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote:
[...]

The instance variable in the D code, `conn`, doesn't have a type. I guess the type should be `Connection`. In the D version of `avmconnect` you're declaring a local variable named `conn` instead of referring to the instance variable.

--
/Jacob Carlborg

Hi Jacob,

Thank you, I have made the below changes, and rebuilt the application, now the application complied without any error, but when i try to access the URL from webpage it errors out with "127.0.0.1 refused to connect"

private Connection conn; //added

scope(exit) conn.close(); //removed

From,
Vino.B

App.d

import vibe.vibe;
import avm.test;

void main()
{
        auto settings = new HTTPServerSettings;
        settings.port = 8080;
        settings.bindAddresses = ["127.0.0.1"];
        listenHTTP(settings, &hello);

        logInfo("Please open http://127.0.0.1:8080/ in your browser.");
        runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
    test t = new avmtest();
    res.writeBody(t.getHostname);
}

Reply via email to