[lwip-users] multiple servers with TCP

2016-04-11 Thread Michael
Hi all
I try to develop a multiple servers with netconn and freeRTOS, the 
application have a telnet server(port 23) and a gateway server(port 6020) in 
two tasks. Both servers are not accept the connection when the both tasks is 
running. but it can accept the connection and data when one server is working. 
what is happened? here is the code:
/*---*/
struct netconn *sh_newconn;
struct netconn *sh_conn;
static void shell_thread(void *arg)
{
//struct netconn *conn, *newconn;
err_t err;
LWIP_UNUSED_ARG(arg);


sh_conn = netconn_new(NETCONN_TCP);
netconn_bind(sh_conn, NULL, 23);
netconn_listen(sh_conn);


while (1) {
err = netconn_accept(sh_conn, _newconn);
if (err == ERR_OK) {
send_str(welcome, sh_newconn);
send_prompt(sh_newconn);
shell_main(sh_newconn);
netconn_delete(sh_newconn);
}
}
}
/*---*/
void shell_init(void)
{
sys_thread_new("shell_thread", shell_thread, NULL, 
DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO+1);
}
/*---*/


struct netconn *gw_newconn;
struct netconn *gw_conn;


static void network_thread(void *arg)
{
static char welcome_msg[] = "CAN gateway is connected."NEWLINE;


//struct netconn *gw_newconn;
//struct netconn *gw_conn;
err_t err;
LWIP_UNUSED_ARG(arg);


gw_newconn = NULL;
gw_conn = netconn_new(NETCONN_TCP);
err = netconn_bind(gw_conn, NULL, 6020);
err = netconn_listen(gw_conn);


while (1) {
err = netconn_accept(gw_conn, _newconn);
if (err == ERR_OK) {
sendstr( welcome_msg, gw_newconn);
net_loop(gw_newconn);
netconn_delete(gw_newconn);
gw_newconn = NULL;
}
}
}
/*---*/
static void gateway_thread(void *arg)
{

}
/*---*/
int gateway_init(void)
{
int ret;
sys_thread_new("gateway", gateway_thread, NULL, DEFAULT_THREAD_STACKSIZE, 
DEFAULT_THREAD_PRIO);
sys_thread_new("network", network_thread, NULL, DEFAULT_THREAD_STACKSIZE, 
DEFAULT_THREAD_PRIO+2);
return TRUE;
}


Thank, 
Micheal___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Problems on Class-B network

2016-04-11 Thread Stephen Cowell

Should be 172 below... sorry.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com

On 4/11/2016 3:42 PM, Stephen Cowell wrote:

Hey Simon...
There is also an NTP client running... using
SNTP.  They have it set to 0.0.0.0, so it's disabled.
I've set my unit up same as theirs, with my
PC as the gateway... works fine.  I just don't
have access to a router that will do the 173
block... most of them are tied to the 192 block,
since that's an easy way to limit the possible
number of clients connected.

Here's their full setup, for completeness:
IP  173.31.147.224
GW  173.31.146.1
Mask  255.255.254.0

I don't have a screenshot of the attempted ping.
__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com

On 4/11/2016 3:09 PM, Sg wrote:

Stephen,

As far as I know, class B network should work OK. I'm running devices 
with "strange" subnets, too, and they have no problem.
Can you post an example IP setting of the device, gateway and client 
trying to ping the device?

Does the device have multiple netifs or only one?

Simon


Stephen Cowell wrote:


I've got an embedded FTP product out in the
field built on lwIP 1.4.1... so far so good... but
now a customer has a problem getting one to
work (static IP) on a class-B (172.31.xxx.xxx)
subnet.  Raw API, no OS... running FatFS
and FTPD on Atmel SAM4E16E.

I have not been able to obtain/set up a similar
situation here yet... I have attached my PC to
my device with a crossover cable and set it to
the customer's Gateway IP... the mask is
255.255.254.0, so it's not the full 1mib address
space.  My sim FTP works fine... but at the customer's
site (overseas, of course) when they set this IP/etc
they can't even ping the device.  For me, it seems
unusual that for every static IP the customer sets,
they also set a unique gateway... not sure why.
The gateway is pingable from the drop to the device,
or at least that's what I've been assured.

We are sending a replacement unit now... I just want
to confirm that this should work no problem on
the class-B subnet.
__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users



Gesendet mit AquaMail für Android
http://www.aqua-mail.com



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users





___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] Problems on Class-B network

2016-04-11 Thread Stephen Cowell

Hey Sergio...
Yes, I'm aware we are 'classless' now, but the
nomenclature was the easiest way to describe/
google it.  I understand /23... much the same as
class-B.

I assume that they have a virtual gateway devoted
to each drop... not sure why, but the gateway is
ping-able.

We are shipping the replacement now... if it still has
problems, perhaps I'll get to visit sunny Austria!
__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com

On 4/11/2016 3:28 PM, Sergio R. Caprile wrote:

Stephen,
there is no concept of IP class in lwIP, and the IP addressing scheme 
you mention is a /23; closer to a class-C than a B ;^)
What you describe sounds pretty strange to me too, looks like your 
customer is not well versed in networking or doing some tricky stuff. 
Either way, you should be able to replicate a problem given the 
network configuration, if you don't... there is a high likelihood that 
they are not doing things right.


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] Problems on Class-B network

2016-04-11 Thread Sg

Stephen,

As far as I know, class B network should work OK. I'm running devices with 
"strange" subnets, too, and they have no problem.
Can you post an example IP setting of the device, gateway and client trying 
to ping the device?

Does the device have multiple netifs or only one?

Simon


Stephen Cowell wrote:


I've got an embedded FTP product out in the
field built on lwIP 1.4.1... so far so good... but
now a customer has a problem getting one to
work (static IP) on a class-B (172.31.xxx.xxx)
subnet.  Raw API, no OS... running FatFS
and FTPD on Atmel SAM4E16E.

I have not been able to obtain/set up a similar
situation here yet... I have attached my PC to
my device with a crossover cable and set it to
the customer's Gateway IP... the mask is
255.255.254.0, so it's not the full 1mib address
space.  My sim FTP works fine... but at the customer's
site (overseas, of course) when they set this IP/etc
they can't even ping the device.  For me, it seems
unusual that for every static IP the customer sets,
they also set a unique gateway... not sure why.
The gateway is pingable from the drop to the device,
or at least that's what I've been assured.

We are sending a replacement unit now... I just want
to confirm that this should work no problem on
the class-B subnet.
__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users



Gesendet mit AquaMail für Android
http://www.aqua-mail.com



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


[lwip-users] Problems on Class-B network

2016-04-11 Thread Stephen Cowell

I've got an embedded FTP product out in the
field built on lwIP 1.4.1... so far so good... but
now a customer has a problem getting one to
work (static IP) on a class-B (172.31.xxx.xxx)
subnet.  Raw API, no OS... running FatFS
and FTPD on Atmel SAM4E16E.

I have not been able to obtain/set up a similar
situation here yet... I have attached my PC to
my device with a crossover cable and set it to
the customer's Gateway IP... the mask is
255.255.254.0, so it's not the full 1mib address
space.  My sim FTP works fine... but at the customer's
site (overseas, of course) when they set this IP/etc
they can't even ping the device.  For me, it seems
unusual that for every static IP the customer sets,
they also set a unique gateway... not sure why.
The gateway is pingable from the drop to the device,
or at least that's what I've been assured.

We are sending a replacement unit now... I just want
to confirm that this should work no problem on
the class-B subnet.
__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] strange TCP behavior, connection stalls

2016-04-11 Thread Sergio R. Caprile
You should first validate the port by running a known to work 
application, pick one from the contrib tree. The port must not call 
basic (non-netconn or non-socket) lwIP functions from different threads.


You must specify which API you are using, and it is quite helpful if you 
post your piece of software.

You seem to be using the socket API, you are definitely using an RTOS.

Where was this capture taken ? Judging by the incorrect checksums 
reported by wireshark, this seems to be taken at the web server 
(offloading).
I can't see why your server is not accepting the first syn. If the 
capture is actually taken at the web server, it should have accepted it.
Your device is missing frames, it asks for the same sent data twice 
(thrice in total) in frames 19 to 23. This is common in bad ports and 
bad layer-2 drivers (and Wi-Fi networks...).


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] API question

2016-04-11 Thread Noam Weissman
Hi Jan,

That's sounds great... 

Thx,
Noam.

-Original Message-
From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On 
Behalf Of Jan Menzel
Sent: Monday, April 11, 2016 11:53 AM
To: lwip-users@nongnu.org
Subject: Re: [lwip-users] API question

Hi Noam!
I recently finished an application with almost the same setup: mbedTLS 
(successor of PolarSSL with better licensing options) via socket API (found 
some example for my MCU which I used as started) and SNTP client from contrib 
tree which uses RAW API. Works very well since month.
Just a side node: TLS/SSL uses a default content length of 16k which is 
acquired twice for tx and rx from the memory pool. For may system (with 64kb 
RAM) this is a lot so I had to reduced it. Luckily we're in control of the 
server so we could incorporate the changes there too.

Jan

On 10.04.2016 14:49, Noam Weissman wrote:
> Hi,
> 
>  
> 
> I am working with LwIP for somewhat 5 years now. I always used it in 
> RAW mode.
> 
> Now I need to start using SSL/TLS and all the code I can find uses BSD 
> Socket's.
> 
>  
> 
> I am working with STM32F4xx/2xx
> 
>  
> 
> I have gotten STM example "Secure socket layer (SSL) for STM32F217 
> microcontroller (AN3365) based on LwIP TCP/IP stack, FreeRTOS and PolarSSL."
> 
> It is running with some problems, related to my server settings... not 
> an issue.
> 
>  
> 
> The LwIP is defined :
> 
> #define LWIP_RAW1
> 
>  
> 
> but also
> 
> #define LWIP_NETCONN 1
> 
> #define LWIP_SOCKET   1
> 
>  
> 
> The above partial settings are as it came from ST !
> 
>  
> 
> --
> ---
> 
> My question is can I use the socket API and run PlarSSL/mbedTLS as is 
> (socket BSD) and also
> 
> Run all my RAW API code,   together ??
> 
>  
> 
> From my understanding I cannot. Can anyone help with this ?
> 
>  
> 
>  
> 
> BR,
> 
> Noam.
> 
>  
> 
> Best Regards,
> 
> Noam Weissman
> 
> Software Engineer.
> 
>  
> 
>   
> 
> Contact information:
> 
> Office: 972-4-9954915
> 
> Fax: 972-4-9550115
> 
> Mobile: 972-52-5786135
> 
> Email: n...@silrd.com
> 
> Web: www.silrd.com 
> 
>  
> 
>  
> 
>  
> 
> 
> 
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] API question

2016-04-11 Thread Jan Menzel
Hi Noam!
I recently finished an application with almost the same setup: mbedTLS
(successor of PolarSSL with better licensing options) via socket API
(found some example for my MCU which I used as started) and SNTP client
from contrib tree which uses RAW API. Works very well since month.
Just a side node: TLS/SSL uses a default content length of 16k which is
acquired twice for tx and rx from the memory pool. For may system (with
64kb RAM) this is a lot so I had to reduced it. Luckily we're in control
of the server so we could incorporate the changes there too.

Jan

On 10.04.2016 14:49, Noam Weissman wrote:
> Hi,
> 
>  
> 
> I am working with LwIP for somewhat 5 years now. I always used it in RAW
> mode.
> 
> Now I need to start using SSL/TLS and all the code I can find uses BSD
> Socket’s.
> 
>  
> 
> I am working with STM32F4xx/2xx
> 
>  
> 
> I have gotten STM example “Secure socket layer (SSL) for STM32F217
> microcontroller (AN3365) based on LwIP TCP/IP stack, FreeRTOS and PolarSSL.”
> 
> It is running with some problems, related to my server settings… not an
> issue.
> 
>  
> 
> The LwIP is defined :
> 
> #define LWIP_RAW1
> 
>  
> 
> but also
> 
> #define LWIP_NETCONN 1
> 
> #define LWIP_SOCKET   1
> 
>  
> 
> The above partial settings are as it came from ST !
> 
>  
> 
> -
> 
> My question is can I use the socket API and run PlarSSL/mbedTLS as is
> (socket BSD) and also
> 
> Run all my RAW API code,   together ??
> 
>  
> 
> From my understanding I cannot. Can anyone help with this ?
> 
>  
> 
>  
> 
> BR,
> 
> Noam.
> 
>  
> 
> Best Regards,
> 
> Noam Weissman
> 
> Software Engineer.
> 
>  
> 
>   
> 
> Contact information:
> 
> Office: 972-4-9954915
> 
> Fax: 972-4-9550115
> 
> Mobile: 972-52-5786135
> 
> Email: n...@silrd.com
> 
> Web: www.silrd.com 
> 
>  
> 
>  
> 
>  
> 
> 
> 
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users