Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
how to use socket? can anyone tell me? — Gideros Forum

how to use socket? can anyone tell me?

I did not find relevant information on the wiki.

Comments

  • MoKaLuxMoKaLux Member
    edited December 2021 Accepted Answer
    https://forum.gideros.rocks/discussion/comment/57021/#Comment_57021
    :)
    yes there is no doc in the wiki for this plugin, will try to make one :p
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • luyimoonluyimoon Member
    edited December 2021
    MoKaLux said:

    https://forum.gideros.rocks/discussion/comment/57021/#Comment_57021
    :)
    yes there is no doc in the wiki for this plugin, will try to make one :p

    thanks :D

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    Accepted Answer

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29 said:
    thanks

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • piepie Member
    Hi I am sorry to resurrect this thread but I am missing something here, I was trying to run the example project:
     
    local socket = require("socket")
    client = socket.connect("google.com", 80)
    client:send("GET /robots.txt HTTP/1.0\r\n\r\n")
    while true do
    	s, status, partial = client:receive(1024)
    	print(s or partial)
    		if status == "closed" then 
    			break 
    		end
    end
    client:close()
    I added Lua Socket plugin inside my project, then copied socket.lua from Gideros\All Plugins\luasocket\source into my project directory and then I get a
    Module math not found
    any hint? Thank you :)
  • MoKaLuxMoKaLux Member
    edited May 2023
    from the gh https://github.com/gideros/gideros/blob/master/plugins/luasocket/source/socket.lua
    -----------------------------------------------------------------------------
    -- LuaSocket helper module
    -- Author: Diego Nehab
    -----------------------------------------------------------------------------
    ...
    local base = _G
    local string = require("string")
    local math = require("math")
    local socket = require("socket.core")
     
    local _M = socket
    But I don't know where the math module is from :'( maybe you can try to comment the line?!
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • piepie Member
    Thank you for your effort :) unfortunately that is the same socket.lua that is inside gideros folder/all plugins. Commenting that line was the first thing I did, but then it could not find socket module.. :#

    I tried loading an old app that was using Artur's unite framework (working at that time, and using luasocket) and it gets the same exact errors: I believe that we missed something through the updates, maybe it's just an outdated syntax which I am not able to identify
  • rrraptorrrraptor Member
    edited May 2023
    @pie use
    local socket = require("socket.core")
    No need to add any lua library
    Outputs:
    HTTP/1.0 200 OK
    Accept-Ranges: bytes
    Vary: Accept-Encoding
    Content-Type: text/plain
    Cross-Origin-Resource-Policy: cross-origin
    Cross-Origin-Opener-Policy-Report-Only: same-origin; report-to="static-on-bigtable"
    Report-To: {"group":"static-on-bigtable","max_age":2592000,"endpoints":[{"url":"<a href="https://csp.withgoogle.com/csp/report-to/static-on-bigtable&quot" rel="nofollow">https://csp.withgoogle.com/csp/report-to/static-on-bigtable&quot</a>;}]}
    Content-Length: 7302
    Date: Sat, 20 May 2023 08:04:59 GMT
    Expires: Sat, 20 May 2023 08:04:59 GMT
    Cache-Control: private, max-age=0
    Last-Modified: Thu, 20 Apr 2023 15:00:00 GMT
    X-Content-Type-Options: nosniff
    Server: sffe
    X-XSS-Protection: 0
     
    User-agent: *
    Disallow: /search
    Allow: /search/about
    Allow: /search/static
    Allow: /search/howsearchworks
    Disallow: /sdch
    Disallow: /groups
    Disallow: /index.html?
    Disallow: /?
    Allow: /?hl=
    Disallow: /?hl=*&
    Allow: /?hl=*&gws_rd=ssl$
    Disallow: /?hl=*&*&gws_rd=ssl
    Allow: /?gws_rd=ssl$
    Allow: /?pt1=true$
    Disallow: /imgres
    Disallow: /u/
    Disallow: /preferences
    Disallow: /setprefs
    Disallow: /default
    Disallow: /m?
    Di
    sallow: /m/
    Allow:    /m/finance
    Disallow: /wml?
    Disallow: /wml/?
    Disallow: /wml/search?
    Disallow: /xhtml?
    Disallow: /xhtml/?
    Disallow: /xhtml/search?
    Disallow: /xml?
    Disallow: /imode?
    Disallow: /imode/?
    Disallow: /imode/search?
    Disallow: /jsky?
    Disallow: /jsky/?
    Disallow: /jsky/search?
    Disallow: /pda?
    Disallow: /pda/?
    Disallow: /pda/search?
    Disallow: /sprint_xhtml
    Disallow: /sprint_wml
    Disallow: /pqa
    Disallow: /palm
    Disallow: /gwt/
    Disallow: /purchases
    Disallow: /local?
    Disallow: /local_url
    Disallow: /shihui?
    Disallow: /shihui/
    Disallow: /products?
    Disallow: /product_
    Disallow: /products_
    Disallow: /products;
    Disallow: /print
    Disallow: /books/
    Disallow: /bkshp?*q=*
    Disallow: /books?*q=*
    Disallow: /books?*output=*
    Disallow: /books?*pg=*
    Disallow: /books?*jtp=*
    Disallow: /books?*jscmd=*
    Disallow: /books?*buy=*
    Disallow: /books?*zoom=*
    Allow: /books?*q=related:*
    Allow: /books?*q=editions:*
    Allow: /books?*q=subject:*
    Allow: /books/about
    Allow: /booksrightsholders
    Allow: /books?*zoom=1*
    Allow: /books?*zoom=5*
    All
    ow: /books/content?*zoom=1*
    Allow: /books/content?*zoom=5*
    Disallow: /ebooks/
    Disallow: /ebooks?*q=*
    Disallow: /ebooks?*output=*
    Disallow: /ebooks?*pg=*
    Disallow: /ebooks?*jscmd=*
    Disallow: /ebooks?*buy=*
    Disallow: /ebooks?*zoom=*
    Allow: /ebooks?*q=related:*
    Allow: /ebooks?*q=editions:*
    Allow: /ebooks?*q=subject:*
    Allow: /ebooks?*zoom=1*
    Allow: /ebooks?*zoom=5*
    Disallow: /patents?
    Disallow: /patents/download/
    Disallow: /patents/pdf/
    Disallow: /patents/related/
    Disallow: /scholar
    Disallow: /citations?
    Allow: /citations?user=
    Disallow: /citations?*cstart=
    Allow: /citations?view_op=new_profile
    Allow: /citations?view_op=top_venues
    Allow: /scholar_share
    Disallow: /s?
    Allow: /maps?*output=classic*
    Allow: /maps?*file=
    Allow: /maps/d/
    Disallow: /maps?
    Disallow: /mapstt?
    Disallow: /mapslt?
    Disallow: /maps/stk/
    Disallow: /maps/br?
    Disallow: /mapabcpoi?
    Disallow: /maphp?
    Disallow: /mapprint?
    Disallow: /maps/api/js/
    Allow: /maps/api/js
    Disallow: /maps/api/place/js/
    Disallow: /maps/api/staticmap
    Disallow: /maps/api/street
    view
    Disallow: /maps/_/sw/manifest.json
    Disallow: /mld?
    Disallow: /staticmap?
    Disallow: /maps/preview
    Disallow: /maps/place
    Disallow: /maps/timeline/
    Disallow: /help/maps/streetview/partners/welcome/
    Disallow: /help/maps/indoormaps/partners/
    Disallow: /lochp?
    Disallow: /center
    Disallow: /ie?
    Disallow: /blogsearch/
    Disallow: /blogsearch_feeds
    Disallow: /advanced_blog_search
    Disallow: /uds/
    Disallow: /chart?
    Disallow: /transit?
    Allow:    /calendar$
    Allow:    /calendar/about/
    Disallow: /calendar/
    Disallow: /cl2/feeds/
    Disallow: /cl2/ical/
    Disallow: /coop/directory
    Disallow: /coop/manage
    Disallow: /trends?
    Disallow: /trends/music?
    Disallow: /trends/hottrends?
    Disallow: /trends/viz?
    Disallow: /trends/embed.js?
    Disallow: /trends/fetchComponent?
    Disallow: /trends/beta
    Disallow: /trends/topics
    Disallow: /musica
    Disallow: /musicad
    Disallow: /musicas
    Disallow: /musicl
    Disallow: /musics
    Disallow: /musicsearch
    Disallow: /musicsp
    Disallow: /musiclp
    Disallow: /urchin_test/
    Disallow: /movies?
    Disallow: /wapsearch?
    Allow: /s
    afebrowsing/diagnostic
    Allow: /safebrowsing/report_badware/
    Allow: /safebrowsing/report_error/
    Allow: /safebrowsing/report_phish/
    Disallow: /reviews/search?
    Disallow: /orkut/albums
    Disallow: /cbk
    Disallow: /recharge/dashboard/car
    Disallow: /recharge/dashboard/static/
    Disallow: /profiles/me
    Allow: /profiles
    Disallow: /s2/profiles/me
    Allow: /s2/profiles
    Allow: /s2/oz
    Allow: /s2/photos
    Allow: /s2/search/social
    Allow: /s2/static
    Disallow: /s2
    Disallow: /transconsole/portal/
    Disallow: /gcc/
    Disallow: /aclk
    Disallow: /cse?
    Disallow: /cse/home
    Disallow: /cse/panel
    Disallow: /cse/manage
    Disallow: /tbproxy/
    Disallow: /imesync/
    Disallow: /shenghuo/search?
    Disallow: /support/forum/search?
    Disallow: /reviews/polls/
    Disallow: /hosted/images/
    Disallow: /ppob/?
    Disallow: /ppob?
    Disallow: /accounts/ClientLogin
    Disallow: /accounts/ClientAuth
    Disallow: /accounts/o8
    Allow: /accounts/o8/id
    Disallow: /topicsearch?q=
    Disallow: /xfx7/
    Disallow: /squared/api
    Disallow: /squared/search
    Disallow: /squared/table
    Disallow: /qnasearch?
    Di
    sallow: /app/updates
    Disallow: /sidewiki/entry/
    Disallow: /quality_form?
    Disallow: /labs/popgadget/search
    Disallow: /buzz/post
    Disallow: /compressiontest/
    Disallow: /analytics/feeds/
    Disallow: /analytics/partners/comments/
    Disallow: /analytics/portal/
    Disallow: /analytics/uploads/
    Allow: /alerts/manage
    Allow: /alerts/remove
    Disallow: /alerts/
    Allow: /alerts/$
    Disallow: /ads/search?
    Disallow: /ads/plan/action_plan?
    Disallow: /ads/plan/api/
    Disallow: /ads/hotels/partners
    Disallow: /phone/compare/?
    Disallow: /travel/clk
    Disallow: /travel/flights/s/
    Disallow: /hotelfinder/rpc
    Disallow: /hotels/rpc
    Disallow: /commercesearch/services/
    Disallow: /evaluation/
    Disallow: /chrome/browser/mobile/tour
    Disallow: /compare/*/apply*
    Disallow: /forms/perks/
    Disallow: /shopping/suppliers/search
    Disallow: /ct/
    Disallow: /edu/cs4hs/
    Disallow: /trustedstores/s/
    Disallow: /trustedstores/tm2
    Disallow: /trustedstores/verify
    Disallow: /adwords/proposal
    Disallow: /shopping?*
    Disallow: /shopping/product/
    Disallow: /shopping/seller
    Disal
    low: /shopping/ratings/account/metrics
    Disallow: /shopping/ratings/merchant/immersivedetails
    Disallow: /shopping/reviewer
    Disallow: /about/careers/applications/
    Disallow: /about/careers/applications-a/
    Disallow: /landing/signout.html
    Disallow: /webmasters/sitemaps/ping?
    Disallow: /ping?
    Disallow: /gallery/
    Disallow: /landing/now/ontap/
    Allow: /searchhistory/
    Allow: /maps/reserve
    Allow: /maps/reserve/partners
    Disallow: /maps/reserve/api/
    Disallow: /maps/reserve/search
    Disallow: /maps/reserve/bookings
    Disallow: /maps/reserve/settings
    Disallow: /maps/reserve/manage
    Disallow: /maps/reserve/payment
    Disallow: /maps/reserve/receipt
    Disallow: /maps/reserve/sellersignup
    Disallow: /maps/reserve/payments
    Disallow: /maps/reserve/feedback
    Disallow: /maps/reserve/terms
    Disallow: /maps/reserve/m/
    Disallow: /maps/reserve/b/
    Disallow: /maps/reserve/partner-dashboard
    Disallow: /about/views/
    Disallow: /intl/*/about/views/
    Disallow: /local/cars
    Disallow: /local/cars/
    Disallow: /local/dealership/
    Disallow: /local/dining/
    Disallow
    : /local/place/products/
    Disallow: /local/place/reviews/
    Disallow: /local/place/rap/
    Disallow: /local/tab/
    Disallow: /localservices/*
    Allow: /finance
    Allow: /js/
    Disallow: /nonprofits/account/
    Disallow: /fbx
    Disallow: /uviewer
    Disallow: /landing/cmsnext-root/
     
    # AdsBot
    User-agent: AdsBot-Google
    Disallow: /maps/api/js/
    Allow: /maps/api/js
    Disallow: /maps/api/place/js/
    Disallow: /maps/api/staticmap
    Disallow: /maps/api/streetview
     
    # Crawlers of certain social media sites are allowed to access page markup when google.com/imgres* links are shared. To learn more, please contact images-robots-allowlist@google.com.
    User-agent: Twitterbot
    Allow: /imgres
     
    User-agent: facebookexternalhit
    Allow: /imgres
     
    Sitemap: <a href="https://www.google.com/sitemap.xml" rel="nofollow">https://www.google.com/sitemap.xml</a>

    Likes: MoKaLux, pie

    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    I think the issue is that luau doesn’t have a ‘require’ call, but Gideros propose a lua implementation of require that don’t have math as pre registered module

    Likes: pie, MoKaLux

    +1 -1 (+2 / -0 )Share on Facebook
  • piepie Member
    edited May 2023
    super, thank you a lot!
    rrraptor said:

    @pie use

    local socket = require("socket.core")
    No need to add any lua library
    It seems to work without Lua Socket plugin at all, at least on android and windows


    [edit: I would like add this bit of info inside a wiki page if only I had the rights to do it: where do you think should it be placed? Inside Lua API? Main Api? Plugins?]


    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited May 2023
    I will create the page lua socket in the wiki asap. I think that should go in the plugins section. DONE :)

    Likes: pie

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    please could you help with filling the wiki for this plugin because I haven't used it yet and I would have to create a test app to help document the wiki.

    Or could you please post a sample code with most functions so I can try it and document it at the same time, thank you :)

    Viva Gideros <3
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • piepie Member
    I would use the official documentation since I guess it is the same thing
    https://w3.impa.br/~diego/software/luasocket/socket.html

    There is also this project which need to be updated, but it was a good example of the use of lua socket: https://github.com/ar2rsawseen/GiderosUnite

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    Ok I will see what I can do, but before writing the wiki I prefer testing the code to make sure it works as intended. I am not into socket right now, I will see what I can do.
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • edited May 2023
    By the way, can we connect to the server with HTTPS/SSL(and TLS)?
    Some servers require Certificate and SSL connection
    (something like this http://mauriciocarneiro.github.io/software/luassl/references.html)
    Coming soon
  • hgy29hgy29 Maintainer
    By the way, if it is to do http or https requests then why not using UrlLoader instead ?

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • piepie Member
    hgy29 said:

    By the way, if it is to do http or https requests then why not using UrlLoader instead ?

    just because I had a working multiplayer system based on unite framework that I built almost 10 yrs ago and I was trying to avoid to rewrite it :smiley:
Sign In or Register to comment.