TCP Lua Socket [Need help]

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
Hello everyone i have an apz name example_Lua_Socket_TCP_Coroutine
this is a client server ams app.. i am working on it to work sending message to server using browser(chrome or Mozilla or iE) but i have no luck.

here is the scenario of what i am trying to achieve but i need your help to make it happen.

the server app start @ 192.168.1.100 port 80

on the other pc connected to the same network or a mobile open the browser and type 192.168.1.100 and it will show up user/password and the html will open with a button
that when it click by the client it will sent to the server as message "Hello World".

the screenshot showing that the server is recieving a connection from the client when i open the link via browser

can anyone help me how to make it happen? any help is highly appreciated.. Thanks you and God bless

Imagen


**** Anyway the server app is working fine with the client app. the client app can send a message my concern about using a browser to send message to the server.. or even just a clickable button that when click it will send to server app "Hello world"..
Hi, in order to display things on browser you must reply to that connection the http headers and contents of site.
You must return headers, at least mime type, status http 200, content lenght and content itself.

fe:

Código: Seleccionar todo

Status: 200 OK;
Mime-type: text/html;
Content-lenght: 2;


OK
It will display OK on the browser, remember you have to release the connection so browser will load the content. Also remember separating headers from content by "/r/n/r/n"

Theres also libs there to create and parse headers for this stuff, i think i have a nice sample in the forum to do that called uiappskelton, i think theres no link now so
HIDE: ON
Hidebb Message Hidden Description
Hello pabloko thanks for your reply its highly appreciated from me. and thanks also for the sample thats great..
however i want the client not opening any AMS app instead only in a browser.. i am not really a programmer and i like ams because there is a lot of examples here and i am slowly learning from it.

i have an image drawn and hope you can help on it.

Imagen

Imagen

i am searching on the internet how to translate the client code into html but i can find i think because i am not fully knowledgeable yet. :hypno:


Anyway if you or anyone could help me provide a sample even just a simple button from htm that when click it send a message "Hello World" or anything to server app.

thank you and God Bless

edit:
i found this example from HT Administrator software
i know this is advance but i only want even just a button to send a message

Imagen
Hello pabloko, i already make it.. i can now control the server aps using ur given example..
my only problem is how to put security on the server?

example the client want to connect open browser put the address and it will ask a username and a password before it can access.. is that posible? thank you so much for your help..
hey, on my example web browser control is optional as you noted. it will display local files on docs folder or return preprogrammed chunks, whre you have access to forms and data sent on GET requests, that you could open on browsers and web control.

in order to ask for password access you can use old http auth, so send to the client this header.

Código: Seleccionar todo

WWW-Authenticate: Basic realm="User Visible Realm"
Connection will be loose for some time so you may want to remove timeout from socket due my timer design and integrate a coroutine or a thread of any kind. When user input the user and password, it will reply a header

Código: Seleccionar todo

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
Being that key a base64 representation of <<Aladdin:OpenSesame>> as username/password

You may want to not complicate stuff and make a user login form in html, retrive the data and allow the rendering of the rest of the site, there are several ways to do it.
Hello Pabloko thanks for your help.. but this time i cannot manage to make security on server using login..
can you give me example where to declare the user and pass?

using html when i input any name and pass it will connect to the server
thnkssssssssssssss
I do wish to see more tcp and p2p udp examples for sure lol :pc:
thnkssssssssssssssssssss
thnksssssssssssssssssss
thank you
Gracias :pc:
gracias
Thank you :pc:
gracias
thank you
Probando!
Mucho gracias.
Thanks