hello everyone, 

I’ve made some small changes to the bekremvax-example in dial(2) in order to get a simple html response:

#include <u.h>
#include <libc.h>

int
bekremvax(void)
{
int dfd, acfd, lcfd;
char adir[40], ldir[40];
int n;
char *buf = „HTTP/1.1 200 OK\nContent-Type: text/html; charset=UTF-8\nContent-Length: 8\n\n<!DOCTYPE html><html><body>hello, world!</body></html>";
	acfd = announce("tcp!*!7", adir);
        if(acfd < 0)
        	return -1;
        for(;;){
        	/* listen for a call */
                lcfd = listen(adir, ldir);

                if(lcfd < 0)
                	return -1;
                /* fork a process to echo */
                switch(fork()){
                case -1:
                	perror("forking");
                        close(lcfd);
                        break;
                case 0:
                	/* accept the call and open the data file */
                        dfd = accept(lcfd, ldir);
                        if(dfd < 0)
                        	return -1;
			print(„incoming request“);
                        write(dfd, buf, sizeof(buf));
                        exits(nil);
                default:
                	close(lcfd);
                        break;
                }
	}
}
void
main()
{
	bekremvax();
	exits(nil);
}

in my browser I’m getting an empty page and with netcat the following output:

nc -v 10.211.55.3 7

Connection to 10.211.55.3 port 7 [tcp/discard] succeeded!

HTTP/1.1%      


there is also no print statement („incoming request“) when I’m trying to reach the service via browser. am I doing something wrong? 9front is running in a vm at the moment, but as far as I can tell there weren’t any issues regarding the network.


thank you very much in advance!


best regards,

Sascha