Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

Home LYnk - Can I use the socket Library?

SpaceLogic KNX Forum

Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • Light and Room Control
  • SpaceLogic KNX Forum
  • Home LYnk - Can I use the socket Library?
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Thomas_Rohde
Sisko Thomas_Rohde Sisko
121
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
54
Heribert_Dölger
Lt. Commander Heribert_Dölger Lt. Commander
30
FZetina
Lt. Commander FZetina Lt. Commander
27
View All
Related Products
product field
SpaceLogic KNX - 4ʺ Touch Unit
product field
KNX Push Button Dynamic Labeling, universal
product field
Wiser for KNX : logic controller

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to SpaceLogic KNX Forum
Solved
deodato
Ensign deodato
Ensign

Posted: ‎2014-07-01 07:34 AM . Last Modified: ‎2024-07-15 12:07 AM

1 Like
5
965
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-01 07:34 AM

Home LYnk - Can I use the socket Library?

Hello,

We are trying to communicate with a Global Caché device that accepts TCP socket connection.

I did some research and LUA is able to this, my questions are:

1 - Is there any library (like this one LuaSocket: Installation) is inside the system? ( or any other )

2 - There is any example available?

The device we are using is this one

http://www.globalcache.com/files/docs/API-GC-100.pdf

Thanks for the help

  • Thumbnail of SpaceLogic KNX - 4ʺ Touch Unit
    SpaceLogic KNX - 4ʺ Touch Unit
  • Thumbnail of KNX Push Button Dynamic Labeling, universal
    KNX Push Button Dynamic Labeling, universal
  • Thumbnail of Wiser for KNX : logic controller
    Wiser for KNX : logic controller
View products (3)
Tags (6)
  • Tags:
  • caché
  • global
  • homelynk
  • knx
  • lua
  • programming
Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
vaca
Ensign vaca
Ensign

Posted: ‎2014-07-09 01:56 AM

1 Like
0
871
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-09 01:56 AM

Hi Francisco,

1 - Is there any library (like this one LuaSocket: Installation) is inside the system? ( or any other )

There is exactly mentioned LuaSocket library available inside hL.

2 - There is any example available?

I attached one example below but in general there are many options what you can do with LuaSockets. So probably best answer is "try to google what exactly you need": LuaSocket: Introduction to the core, LuaSocket: HTTP support, any demo code for lua socket, Luasocket server and actionscript, lua socket client

-- send POST message in XML format to some url address...

require("socket.http")

require("ltn12")

local response, message, address, timeout

-- table to capture response

response = {}

-- message to send

message = "<envelope><body><message>Hello world</message></body></envelope>"

-- address to send to

address = "http://www.example.com:80/some/path"

-- temporarily shorten the timeout

timeout = socket.http.TIMEOUT

socket.http.TIMEOUT = 2

local _, code, headers, status = socket.http.request{

    url = address,

    sink = ltn12.sink.table(response),

    method = "POST",

    headers = {

        ["Content-Length"]  = message:len(),

        ["Content-Type"]    = 'text/xml; charset="utf-8"',

    },

    source = ltn12.source.string(message),

}

-- restore timeout

socket.http.TIMEOUT = timeout

if 200 ~= code then

    -- an error occured, do some action here?

end

response = table.concat(response)

See Answer In Context

Attachments
Reply
Replies 5
vaca
Ensign vaca
Ensign

Posted: ‎2014-07-09 01:56 AM

1 Like
0
872
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-09 01:56 AM

Hi Francisco,

1 - Is there any library (like this one LuaSocket: Installation) is inside the system? ( or any other )

There is exactly mentioned LuaSocket library available inside hL.

2 - There is any example available?

I attached one example below but in general there are many options what you can do with LuaSockets. So probably best answer is "try to google what exactly you need": LuaSocket: Introduction to the core, LuaSocket: HTTP support, any demo code for lua socket, Luasocket server and actionscript, lua socket client

-- send POST message in XML format to some url address...

require("socket.http")

require("ltn12")

local response, message, address, timeout

-- table to capture response

response = {}

-- message to send

message = "<envelope><body><message>Hello world</message></body></envelope>"

-- address to send to

address = "http://www.example.com:80/some/path"

-- temporarily shorten the timeout

timeout = socket.http.TIMEOUT

socket.http.TIMEOUT = 2

local _, code, headers, status = socket.http.request{

    url = address,

    sink = ltn12.sink.table(response),

    method = "POST",

    headers = {

        ["Content-Length"]  = message:len(),

        ["Content-Type"]    = 'text/xml; charset="utf-8"',

    },

    source = ltn12.source.string(message),

}

-- restore timeout

socket.http.TIMEOUT = timeout

if 200 ~= code then

    -- an error occured, do some action here?

end

response = table.concat(response)

Attachments
Reply
deodato
Ensign deodato
Ensign

Posted: ‎2014-07-10 04:59 AM

0 Likes
0
871
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-10 04:59 AM

Hello ,

thanks a lot for your help, I will try to execute the tests here and send you a feedback. In the end I just want to verify if it was possible, now I will create teh necessary scripts to reach the objectives.

Best Regards

Reply
sesa256952
sesa256952 Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2014-07-11 09:23 PM

0 Likes
1
871
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-11 09:23 PM

I'm not sure but the code looks a lot like C# dot NET. (I'm an assembler and C as well as C++ guy)

If I'm correct, a network class library should exist that encapsulates all things Internet such as UDP and TCP as well as some of the popular protocols.

If you have any trouble finding libraries, Sourceforge and GodeGuru are a couple of sites worth searching. They have an amazing array of code, some of it good and some of not so good, but pretty much everything ifs free.

If you plan to use any open source professionally (commercially), beware of the license. Some licenses like BSD are pretty much wide open but some versions of GPL have serious restrictions.

Reply
vaca
Ensign vaca
Ensign

Posted: ‎2014-07-12 01:57 PM

0 Likes
0
871
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-12 01:57 PM

Code is written in Lua, which is scripting language build on "a few" lines of ANSI C. It combines speed of C language and power of scripting and object oriented languages like PHP or Python, only not so comfortable.

Github is also good choice if U need to find some useful lib, but why to do that when Lua already contains pretty good libs in-build?

Reply
deodato
Ensign deodato
Ensign

Posted: ‎2014-07-14 05:11 AM

1 Like
0
871
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-07-14 05:11 AM

Hello,

I did the test and its working pretty fine...

-- Send TCP message to blink the Global Cache power led

-- load the library

local socket = require("socket")

-- definitions of connection

local port = 4998

local ip = '192.168.0.70'

-- create a new TCP object

local tcp = assert(socket.tcp())

-- connects to the port

tcp:connect(ip, port);

-- send the blink message, important to send the char 13 always for this device

assert(tcp:send('blink,1'..string.char(13)))

alert('Device is blinking')

Reply
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of