Hello world/Web server: Difference between revisions
Content added Content deleted
m (→UASM 2.52) |
mNo edit summary |
||
Line 99: | Line 99: | ||
f_flush(o); |
f_flush(o); |
||
}</lang> |
}</lang> |
||
=={{header|Amazing Hopper}}== |
|||
<lang Amazing Hopper> |
|||
// 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) */ |
|||
{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) |
|||
</lang> |
|||
{{out}} |
|||
<pre>Open your browser, and type in the navigation bar: "localhost: 8080": It will show "Goodbye World!" in huge letters and adorable lovecraftian colors! |
|||
</pre> |
|||
=={{header|AntLang}}== |
=={{header|AntLang}}== |