Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
// 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)
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
// Hello world! mode Server: desde el navegador, escriba localhost:8080
|
||||
|
||||
#include <hbasic.h>
|
||||
Begin
|
||||
Declare as Numeric (fd,fdc)
|
||||
as Alpha (message,HEAD,head,body,form,html)
|
||||
|
||||
Let ( HEAD := Cat$("HTTP/1.1 200 OK\n","Content-Type: text/html; charset=UTF-8\n\n") + ("<!DOCTYPE html>\n") )
|
||||
|
||||
ParsNormal$("title","","Bye-bye baby bye-bye")(head)
|
||||
ParsNormal$("style","","body { background-color: #111 } h1 { font-size:4cm; text-align: center; color: black; text-shadow: 0 0 2mm red}")(head)
|
||||
ParsNormal$("head","",head)(html)
|
||||
ParsNormal$("h1","","Goodbye, world!")(body)
|
||||
ParsNormal$("body","",body)(html)
|
||||
|
||||
ParsNormal$("html","",html)(form)
|
||||
Let( form := Cat$(HEAD,form))
|
||||
|
||||
Let( message := Tran$(">\n<","><", form) )
|
||||
Print( message, Newl)
|
||||
|
||||
/* Open socket in localhost (by default) */
|
||||
Let( fd := OpenServerTCP(3,8080) )
|
||||
|
||||
/* accept conection & send message */
|
||||
Let( fdc := Accept(fd) )
|
||||
Send(message,fdc)
|
||||
|
||||
/* close all */
|
||||
CloseSocket(fdc)
|
||||
CloseSocket(fd)
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue