26 lines
788 B
Text
26 lines
788 B
Text
// Hello world! mode Server
|
|
|
|
#include <hopper.h>
|
|
main:
|
|
fd=0,fdc=0,message=""
|
|
|
|
{"HTTP/1.1 200 OK\n","Content-Type: text/html; charset=UTF-8\n\n"}cat
|
|
{"<!DOCTYPE html><html><head><title>Bye-bye baby bye-bye</title>"},cat
|
|
{"<style>body { background-color: #111 },cat
|
|
{"h1 { font-size:4cm; text-align: center; color: black; text-shadow: 0 0 2mm red}</style>"}cat
|
|
{"</head><body><h1>Goodbye, world!</h1></body></html>\n"}cat,
|
|
mov(message)
|
|
|
|
/* Open socket in localhost (by default) */
|
|
/* Accept 5 conections (there are also 5 by default, if you put "any weá" there) */
|
|
{5,8080}socket (OPENTCPSRV), mov(fd)
|
|
|
|
/* accept conection & send message */
|
|
accept(fd), mov(fdc)
|
|
{message},send(fdc)
|
|
|
|
/* close all */
|
|
{fdc}socket(CLOSESOCK)
|
|
{fd}socket(CLOSESOCK)
|
|
|
|
exit(0)
|