eLua network stack

classic Classic list List threaded Threaded
25 messages Options
12
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

eLua network stack

Hello guys,
I was looking for eLua network capabilities to use in a project and I found it's using uIP for that. I have read that uIP has evoluted to iwIP, that is actively developed and has no performance issues compared to uIP.

Other thing I have seem is that eLua net module is experimental, only supports SOCK_STREAM for TCP, no UDP, etc. Would be a pain to switch to iwIP since it has more capabilities than uIP, that could extend featuresin eLua net module and make it more stable?

I thought about doing that by myself as soon as I know more the eLua internal, but I found that could be a good idea come here and discuss with you firstly.

Regards
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Ahhh I forgot to add:

There is some problem with the license of lwIP, if it's added to eLua code?
It uses Modified BSD license.

Cheers!

2013/3/18 Gabriel Duarte <[hidden email]>
Hello guys,
I was looking for eLua network capabilities to use in a project and I found it's using uIP for that. I have read that uIP has evoluted to iwIP, that is actively developed and has no performance issues compared to uIP.

Other thing I have seem is that eLua net module is experimental, only supports SOCK_STREAM for TCP, no UDP, etc. Would be a pain to switch to iwIP since it has more capabilities than uIP, that could extend featuresin eLua net module and make it more stable?

I thought about doing that by myself as soon as I know more the eLua internal, but I found that could be a good idea come here and discuss with you firstly.

Regards
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lukas Kacer Lukas Kacer
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

In reply to this post by gduarte
Hi,
I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512 port. In my case, the TCP server is calling lua scripts to execute, what is different as uIP net module. But don't see big problem with making lua network module for lwip. probably the hardest/tricky part is blocking read from network. I implemented even the write to the network s blocking, so your script is halted until other site do not send ACK on your data. It is a little bit platform depended and probably not the best for client applications, but I think is perfect for servers. 
Do you need network server or client support? which platform are you using?

I plan to publish my project to open source community as soon as it will be published in school what could be in April or May. 

 


On Mar 19, 2013, at 2:46 AM, Gabriel Duarte wrote:

Hello guys,
I was looking for eLua network capabilities to use in a project and I found it's using uIP for that. I have read that uIP has evoluted to iwIP, that is actively developed and has no performance issues compared to uIP.

Other thing I have seem is that eLua net module is experimental, only supports SOCK_STREAM for TCP, no UDP, etc. Would be a pain to switch to iwIP since it has more capabilities than uIP, that could extend featuresin eLua net module and make it more stable?

I thought about doing that by myself as soon as I know more the eLua internal, but I found that could be a good idea come here and discuss with you firstly.

Regards
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

In reply to this post by gduarte
On 19 March 2013 01:46, Gabriel Duarte <[hidden email]> wrote:
> I was looking for eLua network capabilities to use in a project and I found
> it's using uIP for that. I have read that uIP has evoluted to iwIP, that is
> actively developed and has no performance issues compared to uIP.

That would be excellent. I have found that uip is OK as long as you
send it a few bytes every noe and then, but if you try to transfer
data at the maximum rate, leaning on the flow control, it slows down
to 1 byte per second.  At least, I assume that's uIP. THe behaviour
was observed on AVR32 port, but I haven't been able to test the
behaviour on other platforms and no one replied when I asked about it
at the time.

> Other thing I have seem is that eLua net module is experimental, only
> supports SOCK_STREAM for TCP, no UDP, etc. Would be a pain to switch to iwIP
> since it has more capabilities than uIP, that could extend featuresin eLua
> net module and make it more stable?

Well, providing the limited TCP functionality that eLua already
supports should make your task easier. Extending that to UDP means
having to invent more eLua-specific primitives in eLua's "net" module

Another direction to take would be to leave the existing net interface
as it is, and make the eLua interface to LWIP compatibile with
luasocket, which saves you having to invent an interface to UDP, ICMP
and the rest, is sure to be an interface that can do everything, and
would allow eLua users to use the hundreds of Lua libraries that
depend on luasocket.

On the one hand, it means taking on two projects instead of one, but
on the other it might be easier to achieve. Presumably, when LWIP
works on all platforms, either "net" could be reimplemented as an
compatability interface to luasocket (and probably in Lua!) or left as
yet another alternative-compilation-option, if LWIP turns out to be
significantly larger than uIP.

    M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

In reply to this post by gduarte
On 19 March 2013 01:49, Gabriel Duarte <[hidden email]> wrote:
> Ahhh I forgot to add:
>
> There is some problem with the license of lwIP, if it's added to eLua code?
> It uses Modified BSD license.
> http://en.wikipedia.org/wiki/LwIP

The only extra condition is:

* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.

So putting the BSD licence, referred to the LWIP component, in some
text file included with binary dists will be enough.

    M

"We are riding the wavefront of technology
And behind the wavefront is a trough
And the trough is full of lawyers."
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

In reply to this post by gduarte
Hi,

On Tue, Mar 19, 2013 at 3:46 AM, Gabriel Duarte <[hidden email]> wrote:
Hello guys,
I was looking for eLua network capabilities to use in a project and I found it's using uIP for that. I have read that uIP has evoluted to iwIP, that is actively developed and has no performance issues compared to uIP.

That's only partially correct. uIP didn't quite evolve to lwIP, they are different stacks with different capabilities and quite different memory requirements (which is why eLua uses uIP at the moment).


Other thing I have seem is that eLua net module is experimental, only supports SOCK_STREAM for TCP, no UDP, etc. Would be a pain to switch to iwIP since it has more capabilities than uIP, that could extend featuresin eLua net module and make it more stable?

This is something we take under consideration, but no final decision was made yet.
 

I thought about doing that by myself as soon as I know more the eLua internal, but I found that could be a good idea come here and discuss with you firstly.

By all means, please do it. While you're at it, you can also suggest ways to improve our platform interface and overall network API, since that's an area where eLua needs a lot of improvement.

Best,
Bogdan
 

Regards
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

In reply to this post by Lukas Kacer
On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
> port.

!

> In my case, the TCP server is calling lua scripts to execute

!!

> I implemented even the write to the network s blocking, so
> your script is halted until other site do not send ACK on your data.

How do you inplement the extra interfaces at a Lua level? Extensions
to the "net" module?
Or do you just implement the existing "net" interface?

> It is a
> little bit platform depended and probably not the best for client
> applications, but I think is perfect for servers.
> Do you need network server or client support? which platform are you using?

Speaking from a developer point of view, that is not a problem to
consider when designing a new network interface because people will
want clients, servers, client-servers, and on all platforms. The
interface must allow everything that people might want.

> I plan to publish my project to open source community as soon as it will be
> published in school what could be in April or May.

I can't wait! If you can arrive earlier that is good, as it will maybe
save us some time.

   M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

@martinguy

Good you liked! I been talking to people who already have use uIP with eLua and they said that it gets confused and slow when it tries to open more than 3 or 4 sockets, so, that's a big problem from point of view. At first, we could provide only TCP functionality, but with no issues from uIP. Extending to UDP would be a big step, but I think that TCP is more important at the moment and then after we can think about how to extend the net modulo to fit UDP features.

You had the SAME idea I had yesterday. Make luasocket compatible with lwIP, that could REALLY extend the eLua network features.

 You said that lwIP could turns out to be significantly larger than uIP, but I think that today our hardware is not as limited as it was few years ago, either in RAM and ROM size, etc, so, I think that we could put lwIP as a replacement to uIP if it proves it's better in many aspects.

About the license, good that there's no problem in adding it to eLua.


@Bogdan

Sorry, my mistake.. I said it's an evolution from uIP, but they  just started being developed by the same guy, but not derivated from each other.

You really think that now, at these days we still have so memory problems to room lwIP? The lwIP wiki says:

"The focus of the lwIP TCP/IP implementation is to reduce resource usage while still having a full scale TCP. This makes lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM."

I will try to start something, at least compile lwIP, since I really new to eLua and the embedded world.


@Lukas Kacer

Please, share you us your work, as Martin said, could save a lot of time :) I am really interested in :)


Best regards,
Gabriel



2013/3/19 martinwguy <[hidden email]>
On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
> port.

!

> In my case, the TCP server is calling lua scripts to execute

!!

> I implemented even the write to the network s blocking, so
> your script is halted until other site do not send ACK on your data.

How do you inplement the extra interfaces at a Lua level? Extensions
to the "net" module?
Or do you just implement the existing "net" interface?

> It is a
> little bit platform depended and probably not the best for client
> applications, but I think is perfect for servers.
> Do you need network server or client support? which platform are you using?

Speaking from a developer point of view, that is not a problem to
consider when designing a new network interface because people will
want clients, servers, client-servers, and on all platforms. The
interface must allow everything that people might want.

> I plan to publish my project to open source community as soon as it will be
> published in school what could be in April or May.

I can't wait! If you can arrive earlier that is good, as it will maybe
save us some time.

   M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lukas Kacer-2 Lukas Kacer-2
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

In reply to this post by Martin Guy

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lukas Kacer Lukas Kacer
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

I was thinking that I would upload  my project (with all the mess) to dropbox and 
send link to all of you who are interested if you will promise that you will not publish 
it new few months. 
So anyone who wants it now can send me direct email. I will try to upload it this evening.



On Mar 19, 2013, at 15:49 PM, Gabriel Duarte wrote:

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Please, do it :-)

Thank you very much!

2013/3/19 Lukas Kacer <[hidden email]>
I was thinking that I would upload  my project (with all the mess) to dropbox and 
send link to all of you who are interested if you will promise that you will not publish 
it new few months. 
So anyone who wants it now can send me direct email. I will try to upload it this evening.



On Mar 19, 2013, at 15:49 PM, Gabriel Duarte wrote:

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lukas Kacer Lukas Kacer
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Gabriel, did you get that message with dropbox link and short description of the code I sent directly to your email address? 

On Mar 20, 2013, at 20:00 PM, Gabriel Duarte wrote:

Please, do it :-)

Thank you very much!

2013/3/19 Lukas Kacer <[hidden email]>
I was thinking that I would upload  my project (with all the mess) to dropbox and 
send link to all of you who are interested if you will promise that you will not publish 
it new few months. 
So anyone who wants it now can send me direct email. I will try to upload it this evening.



On Mar 19, 2013, at 15:49 PM, Gabriel Duarte wrote:

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Hello Lukas,
I will grab the code tonight. Dont worry, I will not publish the code without our authorization!
 
Thank  you very much!

2013/3/21 Lukas Kacer <[hidden email]>
Gabriel, did you get that message with dropbox link and short description of the code I sent directly to your email address? 

On Mar 20, 2013, at 20:00 PM, Gabriel Duarte wrote:

Please, do it :-)

Thank you very much!

2013/3/19 Lukas Kacer <[hidden email]>
I was thinking that I would upload  my project (with all the mess) to dropbox and 
send link to all of you who are interested if you will promise that you will not publish 
it new few months. 
So anyone who wants it now can send me direct email. I will try to upload it this evening.



On Mar 19, 2013, at 15:49 PM, Gabriel Duarte wrote:

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Grabbed! I will take a look now!

Thanks again!!!

2013/3/21 Gabriel Duarte <[hidden email]>
Hello Lukas,
I will grab the code tonight. Dont worry, I will not publish the code without our authorization!
 
Thank  you very much!

2013/3/21 Lukas Kacer <[hidden email]>
Gabriel, did you get that message with dropbox link and short description of the code I sent directly to your email address? 

On Mar 20, 2013, at 20:00 PM, Gabriel Duarte wrote:

Please, do it :-)

Thank you very much!

2013/3/19 Lukas Kacer <[hidden email]>
I was thinking that I would upload  my project (with all the mess) to dropbox and 
send link to all of you who are interested if you will promise that you will not publish 
it new few months. 
So anyone who wants it now can send me direct email. I will try to upload it this evening.



On Mar 19, 2013, at 15:49 PM, Gabriel Duarte wrote:

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/



--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

I took a look at eLua's source code to know how eLua interfaces with uIP.
I saw that net module uses functions described into elua_uip.c, right?

So, in theory, if I implement the eLua net module calls using lwIP, should just work, right?

I know it's not that, but the flow is correct at least?


Cheers

2013/3/22 Gabriel Duarte <[hidden email]>
Grabbed! I will take a look now!

Thanks again!!!


2013/3/21 Gabriel Duarte <[hidden email]>
Hello Lukas,
I will grab the code tonight. Dont worry, I will not publish the code without our authorization!
 
Thank  you very much!

2013/3/21 Lukas Kacer <[hidden email]>
Gabriel, did you get that message with dropbox link and short description of the code I sent directly to your email address? 

On Mar 20, 2013, at 20:00 PM, Gabriel Duarte wrote:

Please, do it :-)

Thank you very much!

2013/3/19 Lukas Kacer <[hidden email]>
I was thinking that I would upload  my project (with all the mess) to dropbox and 
send link to all of you who are interested if you will promise that you will not publish 
it new few months. 
So anyone who wants it now can send me direct email. I will try to upload it this evening.



On Mar 19, 2013, at 15:49 PM, Gabriel Duarte wrote:

You could at least show how to compile lwIP and connect it to eLua :)

2013/3/19 Lukas Kacer <[hidden email]>

On Mar 19, 2013, at 12:18 PM, martinwguy wrote:

> On 19 March 2013 03:03, Lukas Kacer <[hidden email]> wrote:
>> I was able to use LwIP raw tcp api and matrixSSL with eLua on at91sam7x512
>> port.
>
> !
>
>> In my case, the TCP server is calling lua scripts to execute
>
> !!
>
>> I implemented even the write to the network s blocking, so
>> your script is halted until other site do not send ACK on your data.
>
> How do you inplement the extra interfaces at a Lua level? Extensions
> to the "net" module?
> Or do you just implement the existing "net" interface?
I removed all net module code.

The script execution is driven by events in the network. it's working like this:
Bind to network port is done in different script (or C startup code)
than the network read and write functions. The script with read/write functions
is executed when new connection appears from callback function called from lwIP.
the only problem with this is, that you need to exit that callback function and return
to lwIP to read more data or make real write to network. you can call lwip tcp_send()
but that data will be buffered and will leave tcp/ip stack after return from callback. To
solve this I do setjmp(parent); setjmp(child); child[x] = malloc(stack_size) before executing
script and from in module.write/read functions I do setjmp(child); longjmp(parrent).
this "pauses" execution of script until you get ACK from client on sent data or you
have new data to read.

setjmp(child); child[x] = malloc(stack_size)  is creating new stack for lua script that
will be executed. it's platform depended, but it is not something
hard to do. you just net to find out where setjmp save register with stack address.

it is a little bit more complicated I'm my code, as I have also matrixSSL between
lwIP and lau script. And the lua script is in my case WSAPI, which I had to partially
rewrite to C, because I was running out of memory.

>
>> It is a
>> little bit platform depended and probably not the best for client
>> applications, but I think is perfect for servers.
>> Do you need network server or client support? which platform are you using?
>
> Speaking from a developer point of view, that is not a problem to
> consider when designing a new network interface because people will
> want clients, servers, client-servers, and on all platforms. The
> interface must allow everything that people might want.

Speaking from a developer point of eLua yes. But I wanted to know if he wants network
support for some specific project and if it's close to my one, I would be able to help him.

I know that a lot of users would love to see clients, servers, client-servers support and
the best to port apps to eLua is luasockets, but I not sure if socket API is the good one for eLua and
would not be much easier and effective to create just some kind of wrappers for lwIP.
From what I see, in actual eLua net module(which is socket based) is impossible to create server(s) unless
you want to read with timeout in loop from all sockets that you opened. And in C code
of net module you then do loop read until you read something or timeout expires if I
remember it right. And as it is embedded system, we should care about that as
it can be problem for some users/devices/applications.

>
>> I plan to publish my project to open source community as soon as it will be
>> published in school what could be in April or May.
>
> I can't wait! If you can arrive earlier that is good, as it will maybe
> save us some time.
not sure if you/anyone should wait for that. I think now that your goal is probably
different from what my project does.  When I was choosing/creating the theme more
than year ago, I wanted to create some real value to the community. But now I see
it moved to totally different direction and I'm not sure if it is wort of something
(besides one fixed bug in matrixSSL api) and all I want is finally publish it == finish school
and get a real job.

Lukas

>
>   M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/



--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/



--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

On 22 March 2013 22:48, Gabriel Duarte <[hidden email]> wrote:
> I took a look at eLua's source code to know how eLua interfaces with uIP.
> I saw that net module uses functions described into elua_uip.c, right?

If I remember correctly, yes, but it doesn't end there.

For uIP, those then call functions in
src/platform/*/platform.c
called platform_ethernet_setup(), platform_eth_send_packet() and so
on, as well as having a timer running in the background to do
something periodically - probably to service timeouts and to retry
lost packets, but have a look at what it is used for in uIP.

If you are lucky, the platform_ethernet_*() functions and the timer
will allow you to implemented them on top of lwIP, but only if you are
lucky. Note that they depend on #ifdef BUILD_UIP, which turns the
whole NET/ETHERNET subsystem and eLua module on and off, so you will
also have to split all BUILD_UIP-dependent code into what is
BUILD_UIP-specific, what is BUILD_LWIP-specific and what is
BUILD_NET-specific.
You can probably assume that BUILD_NET == BUILD_UIP || BUILD_LWIP, and
that only one of BUILD_UIP and BUILD_LWIP can ever be defined at the
same time.

Note that there is also the option to have the eLua console on a
telnet port, which is a different route to the platform_ethernet_*()
functions, in addition to the Lua net.*() functions. Have a look at
that path through the code also - my feeling it that is probably won't
cause problems, but might help you understand the code structure, to
see two different users of the ethernet subsystem.

> So, in theory, if I implement the eLua net module calls using lwIP, should
> just work, right?

Oh, in theory, yes, everything should always just work.
That's why computer programming is so easy. :)

   M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lukas Kacer Lukas Kacer
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Hi.
I'm looking at elua_uip_mainloop in elua_net.c  function for a while and don't understand one thing. 
Why is almost at the end the for loop that calls uip_periodic executed also when periodic_timer < UIP_PERIODIC_TIMER_MS ?

uIP documentation says about uip_periodic: "should be called when the periodic uIP timer goes off"

so if I'm not missing something, it is ineffective to do that for loop after every received packet. But still it is not wrong.

can it be that this is affecting the bad behavior with more opened sockets and executing that for loop 
just if periodic_timer >= UIP_PERIODIC_TIMER_MS would partially speed up things.

Can someone look at it if I'm right? 

Lukas

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
gduarte gduarte
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Lukas,
do you plan to merge your lwIP port to eLua?

Cheers!


2013/4/27 Lukas Kacer <[hidden email]>
Hi.
I'm looking at elua_uip_mainloop in elua_net.c  function for a while and don't understand one thing. 
Why is almost at the end the for loop that calls uip_periodic executed also when periodic_timer < UIP_PERIODIC_TIMER_MS ?

uIP documentation says about uip_periodic: "should be called when the periodic uIP timer goes off"

so if I'm not missing something, it is ineffective to do that for loop after every received packet. But still it is not wrong.

can it be that this is affecting the bad behavior with more opened sockets and executing that for loop 
just if periodic_timer >= UIP_PERIODIC_TIMER_MS would partially speed up things.

Can someone look at it if I'm right? 

Lukas

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Lukas Kacer Lukas Kacer
Reply | Threaded
Open this post in threaded view
|

Re: eLua network stack

Hi Gabriel.
I don't fully understand what you meant by "merge", so here is my plan.
I plan to put my work to git at 15th May or maybe before. (that is my deadline for thesis. )

Based on that work should be anybody able to use lwIP with existing eLua "Ethernet driver" for other platforms with small changes. but I think that my solution isn't best and can be improved.

I don't use lwIP to do network communication from lua script as it was with uIP and lua net module. 
I use lwIP raw API and matrixSSL library to make simple HTTPS server. that server can run lua scripts in which you can theoretically receive and send as manny data as you want.

I have some plans with making some network module for eLua that will use lwIP, but don't know when and it will probably not be close future. 
or maybe I will try do something based on existing eLua net using lwIP and matrixSSL.
Lukas

On May 2, 2013, at 19:16 PM, Gabriel Duarte wrote:

Lukas,
do you plan to merge your lwIP port to eLua?

Cheers!


2013/4/27 Lukas Kacer <[hidden email]>
Hi.
I'm looking at elua_uip_mainloop in elua_net.c  function for a while and don't understand one thing. 
Why is almost at the end the for loop that calls uip_periodic executed also when periodic_timer < UIP_PERIODIC_TIMER_MS ?

uIP documentation says about uip_periodic: "should be called when the periodic uIP timer goes off"

so if I'm not missing something, it is ineffective to do that for loop after every received packet. But still it is not wrong.

can it be that this is affecting the bad behavior with more opened sockets and executing that for loop 
just if periodic_timer >= UIP_PERIODIC_TIMER_MS would partially speed up things.

Can someone look at it if I'm right? 

Lukas

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
12