Problem with net module in LM3S

classic Classic list List threaded Threaded
3 messages Options
Marcus Vinicius Costa Marcus Vinicius Costa
Reply | Threaded
Open this post in threaded view
|

Problem with net module in LM3S

Hi,

I need help with the net module in LM3S8962, i try use this but i have an error to listen a port.

I use in my code the source:
sock, remoteip, err = net.accept( 7474, 1, 10000 )

The function return in err variable a value -1, and never listen the port

I checked the source file and found this code
int elua_accept( u16 port, unsigned timer_id, timer_data_type to_us, elua_net_ip* pfrom )
{
  timer_data_type tmrstart = 0;
  int old_status;
  
  if( !elua_uip_configured )
    return -1; ...
I receiced -1 in err because the elua_uip_configured is false, but when i do this for true? I try generate another bin file in web builder with the DHCP and DNS active but not work too.

When I ping the direct IP received by DHCP router the module response OK, but if I ping the host name elua the module is not found in the network.

I try send data to test using this code:

  local ip = net.packip(192,168,0,104)
            local socket = net.socket(net.SOCK_STREAM)
            local err = net.connect(socket, ip, 7475, 1, 10000)
            if(err == net.ERR_OK) then
                local res, err = net.send( socket, "Send "..tostring(countSend).."\n")
            end
            net.close(socket)


I open a server tcp/ip using hercules terminal and received the data normally, if i start the connection the module works fine, but to listen not work.

Thanks for help
Marcus Vinicius

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

Re: Problem with net module in LM3S

Hi Marcus, about WebBuilder problem, another user already notified the same issue and was fixed today, please check again and let me know.

Thanks,
Vagner

On Wed, May 2, 2012 at 2:17 PM, Marcus Vinicius Costa <[hidden email]> wrote:
Hi,

I need help with the net module in LM3S8962, i try use this but i have an error to listen a port.

I use in my code the source:
sock, remoteip, err = net.accept( 7474, 1, 10000 )

The function return in err variable a value -1, and never listen the port

I checked the source file and found this code
int elua_accept( u16 port, unsigned timer_id, timer_data_type to_us, elua_net_ip* pfrom )
{
  timer_data_type tmrstart = 0;
  int old_status;
  
  if( !elua_uip_configured )
    return -1; ...
I receiced -1 in err because the elua_uip_configured is false, but when i do this for true? I try generate another bin file in web builder with the DHCP and DNS active but not work too.

When I ping the direct IP received by DHCP router the module response OK, but if I ping the host name elua the module is not found in the network.

I try send data to test using this code:

  local ip = net.packip(192,168,0,104)
            local socket = net.socket(net.SOCK_STREAM)
            local err = net.connect(socket, ip, 7475, 1, 10000)
            if(err == net.ERR_OK) then
                local res, err = net.send( socket, "Send "..tostring(countSend).."\n")
            end
            net.close(socket)


I open a server tcp/ip using hercules terminal and received the data normally, if i start the connection the module works fine, but to listen not work.

Thanks for help
Marcus Vinicius

_______________________________________________
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
Marcus Vinicius Costa Marcus Vinicius Costa
Reply | Threaded
Open this post in threaded view
|

Re: Problem with net module in LM3S

Hello Vagner,

The WebBuilder is working properly now and, with the new build generated, I was able test and access the development board.

On the problem to establish the connection, the implementation of Ethernet with the uIP loses packet a lot and has no buffer for receiving data and connection. When using the function accept (net.accept) with timeout the remote host has to request the communication just at the moment where the function will run otherwise the connection or the data received (if the function was net.recv) will be lost.

I changed  the remote software to solve this problem. I implemented the request with a timeout less than the Lua timeout and if it fails to send the data it will tries to run again with small timeouts and followed attempts and submission, so he makes sure that will come together with the listenner. In testing it can connect on the second or third attempt.

Thanks
Marcus



2012/5/2 Vagner nascimento <[hidden email]>
Hi Marcus, about WebBuilder problem, another user already notified the samuilde issue and was fixed today, please check again and let me know.

Thanks,
Vagner

On Wed, May 2, 2012 at 2:17 PM, Marcus Vinicius Costa <[hidden email]> wrote:
Hi,

I need help with the net module in LM3S8962, i try use this but i have an error to listen a port.

I use in my code the source:
sock, remoteip, err = net.accept( 7474, 1, 10000 )

The function return in err variable a value -1, and never listen the port

I checked the source file and found this code
int elua_accept( u16 port, unsigned timer_id, timer_data_type to_us, elua_net_ip* pfrom )
{
  timer_data_type tmrstart = 0;
  int old_status;
  
  if( !elua_uip_configured )
    return -1; ...
I receiced -1 in err because the elua_uip_configured is false, but when i do this for true? I try generate another bin file in web builder with the DHCP and DNS active but not work too.

When I ping the direct IP received by DHCP router the module response OK, but if I ping the host name elua the module is not found in the network.

I try send data to test using this code:

  local ip = net.packip(192,168,0,104)
            local socket = net.socket(net.SOCK_STREAM)
            local err = net.connect(socket, ip, 7475, 1, 10000)
            if(err == net.ERR_OK) then
                local res, err = net.send( socket, "Send "..tostring(countSend).."\n")
            end
            net.close(socket)


I open a server tcp/ip using hercules terminal and received the data normally, if i start the connection the module works fine, but to listen not work.

Thanks for help
Marcus Vinicius

_______________________________________________
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


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