NetDcuA5 with WCE6, how to connect via the Internet

      NetDcuA5 with WCE6, how to connect via the Internet

      As I am new to this question, I am not sure where to start and kindly ask for a little bit help.

      We are running the NetDcuA5 with WC6. The main task of our application is the human-machine-interface. We use a touch screen for inputs and a TFT display as a graphical status display for the machine and to enter parameters and setpoints.

      Next step is to get this status Information over the internet. Goal is to connect to the NetDcuA5 over the internet and to send and receive data. It is not necessary to display anything else beside what is shown until now, it is not necessary to use a browser, we just want to exchange data.
      Idea is that the customer just plugs his Ethernet wire into the NetDcuA5 making it possible to connect to the NetDcuA5 from my PC here in Germany independend from where the machine is actually running.

      How to start this?
      What do I need?
      How can this be done?

      THANK YOU

      Dirk
      Hello,

      i would use FTP-Server. This service is enabled by default. Is this possible?

      Try to connect via command shell (ftp<enter>...) or a web browser (ftp:\\<ipadress>). For tests you may use FS Device Spy Tool to detect and list the boards in your local area network (see downloads).

      In our download area or msdn you find also documention about ftp setting.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      If I connect the NetDcuA5 to our company network, the NetDcu gets an IP address from the Server. How can I find out this actual IP adress within my own application programm? I want to show the user the actual IP adress of the NetDcuA5.

      Can the port 21 which is used for the FTP protocol be changed?

      THANK YOU
      Dirk
      Which is your programming language? Every language offers an API for retreive Network Adatpter Information. E.g. using c++ language refer the "IP Helper Functions".
      FTP Server uses port 21 while connect, refer slacksite.com/other/ftp.html.
      Try the ftp "port" command for change the port.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

      Post was edited 1 time, last by “fs-support_ZU” ().

      I use C++ and VisualStudio2005.
      In the HELP I found an example code:

      #include <stdio.h>
      #include <windows.h>
      #include <iphlpapi.h>
      main() {
      FIXED_INFO * FixedInfo;
      ULONG ulOutBufLen;
      DWORD dwRetVal;
      IP_ADDR_STRING * pIPAddr;

      FixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, sizeof( FIXED_INFO ) );
      ulOutBufLen = sizeof( FIXED_INFO );

      if( ERROR_BUFFER_OVERFLOW == GetNetworkParams( FixedInfo, &ulOutBufLen ) ) {
      GlobalFree( FixedInfo );
      FixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, ulOutBufLen );
      }

      if ( dwRetVal = GetNetworkParams( FixedInfo, &ulOutBufLen ) ) {
      printf( "Call to GetNetworkParams failed. Return Value: %08x\n", dwRetVal );
      }
      else {
      printf( "Host Name: %s\n", FixedInfo -> HostName );
      printf( "Domain Name: %s\n", FixedInfo -> DomainName );

      printf( "DNS Servers:\n" );
      printf( "\t%s\n", FixedInfo -> DnsServerList.IpAddress.String );

      pIPAddr = FixedInfo -> DnsServerList.Next;
      while ( pIPAddr ) {
      printf( "\t%s\n", pIPAddr ->IpAddress.String );
      pIPAddr = pIPAddr ->Next;
      }
      }
      exit( 0 );
      }

      But I can not compile it. The compile finds the "
      iphlpapi.h", and it includes the "GetNetworkParams", but the linker gives me an error saying that the "GetNetworkParams" can not be found.
      What is wrong?

      THANK YOU
      Dirk
      "Iphlpapi.dll" should come with the SDK.
      You have explicite to link against the dll using: Project Settings -> Linker -> Additional Libraries.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      THANK YOU VERY MUCH.
      I can compile und run the Programm now.
      If I use the CE desktop to find out the actual network address, it shows me that the NetDcuA5 uses the 10.10.2.12.
      After starting my application, thre IP addresses are listed:
      10.0.0.1
      0.0.0.0
      127.0.0.1
      But NOT the 10.10.2.12. Why can I not see the 10.10.2.12?

      On the other hand, it might be easier for the user to set the IP address including subnet and gateway and to use fixed values.
      My question:
      Where in the registry can I find the values to switch off the DHCP becaused fixed values should be used?
      Where in the registry can I find the settings for IP address, subnet and gateway?

      Or is it better to use the "IP Helper" for switching off the DHCP and for setting the addresses? But how? I can not find functions that will do it.

      THANK YOU
      Dirk

      Post was edited 1 time, last by “Dirk” ().

      Or is it better to use the "IP Helper" for switching off the DHCP and for setting the addresses? But how? I can not find functions that will do it.

      You may use this values (HKLM\COMM\ETHNETA1\Parms\TCPIP or (...\ETHNETB1\...)). But this approach has a big disadvantage it is only valid for the internal NetDCUA5 Adapter(s). Using a WLAN extension or an other board your SW won't find any Ethernet-Adapter. So I would use the "IP Helper".

      On the other hand, it might be easier for the user to set the IP address including subnet and gateway and to use fixed values

      Fix IP values may not be possible in a special customer Network other customer may use fix values only. Think you have to provide both options by your SW.

      Note, there may be more than one adater active! E.g. ActiveSync also gets an IP!
      List all adapters:

      Source Code

      1. ULONG outBufLen = 0;
      2. DWORD dwRetVal = 0;
      3. int i;
      4. IP_ADAPTER_INFO* pAdapterInfos = (IP_ADAPTER_INFO*) malloc(sizeof(IP_ADAPTER_INFO));
      5. // retry up to 5 times, to get the adapter infos needed
      6. for( i = 0; i < 5 && (dwRetVal == ERROR_BUFFER_OVERFLOW || dwRetVal == NO_ERROR); ++i )
      7. {
      8. dwRetVal = GetAdaptersInfo(pAdapterInfos, &outBufLen);
      9. if( dwRetVal == NO_ERROR )
      10. {
      11. break;
      12. }
      13. else if( dwRetVal == ERROR_BUFFER_OVERFLOW )
      14. {
      15. free(pAdapterInfos);
      16. pAdapterInfos = (IP_ADAPTER_INFO*) malloc(outBufLen);
      17. }
      18. else
      19. {
      20. pAdapterInfos = 0;
      21. break;
      22. }
      23. }
      24. if( dwRetVal == NO_ERROR )
      25. {
      26. IP_ADAPTER_INFO* pAdapterInfo = pAdapterInfos;
      27. while( pAdapterInfo )
      28. {
      29. // check info retreived for each adapter ...
      30. pAdapterInfo = pAdapterInfo->Next;
      31. }
      32. }
      33. else
      34. {
      35. bRet = FALSE;
      36. }
      37. free(pAdapterInfos);

      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

      Post was edited 2 times, last by “fs-support_ZU” ().

      PS: I did sometimes follwing for switch DHCP on/off using ndis.h functions. Maybe not the smatest way!

      Source Code

      1. UnbindNetworkAdapter(THENETADAPTER);
      2. EnableDHCP(THENETADAPTER, 1);
      3. // TODO Reg save
      4. RebindNetworkAdapter(THENETADAPTER);


      Where EnableDHCP is:

      Source Code

      1. BOOL EnableDHCP(TCHAR* szAdapter, DWORD dwEnableDHCP)
      2. {
      3. CRegKey cRegKey;;
      4. BOOL bRes = FALSE;
      5. TCHAR sz[MAX_PATH]={0};
      6. _tcscpy(sz, _T("\\comm\\"));
      7. _tcscat(sz, szAdapter);
      8. _tcscat(sz, _T("\\parms\\tcpip"));
      9. if( ERROR_SUCCESS == cRegKey.Open(HKEY_LOCAL_MACHINE, sz) )
      10. {
      11. if(ERROR_SUCCESS != cRegKey.SetValue(_T("EnableDHCP"), dwEnableDHCP))
      12. return bRes;
      13. bRes = TRUE;
      14. }
      15. return bRes;
      16. }
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      THANK YOU.
      I found in the documentation that I can crate a "FTP ServerUser List" in the registry. Okay so far, I can add the names of users allowed to access or not.
      But where to store the passwords for this users?
      I found the mark: "For more Information see Web Server Access Rights", but where can I find this?

      Dirk
      Hello,
      ndcucfg offers possibility to set password refer: How to protect FTP by Username and Password For more details and futher links about FTPD refer the MSDN online help "FTP Server Registry Settings".
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      Hello
      Using ndcucfg to set usernames and passwords works fine.
      BUT: How can I set the username and password from inside my application? Or how can it be set without starting the ndcucfg?
      I want to set the same usernames and passwords for all NetDCUA5 we build into our generators and this usernames and passwords should be set automatically, it should not be necessary during manufacturing to start the netdcucfg.
      Can it be set using the WinNDCUCfg?
      Best solution would be to set it from my application.

      Another question: Is it possible to give different users different access rights to folders inside the NetDCUA5?
      If yes, how can this be done?

      THANK YOU
      Dirk
      Hello,

      a) ndcucfg provides a library, refer downloads (check if the commands available there)
      b) Use "NTLMSetUserInfo" if you do not have the lib use "LoadLibrary" for access the dll.

      ... it should not be necessary during manufacturing to start the netdcucfg.
      How do you do other configuratons - can you add the commands there?
      Can it be set using the WinNDCUCfg?
      Why not?

      Another question: Is it possible to give different users different access rights to folders inside the NetDCUA5?
      Not for the general system but for FTPD, refer msdn.microsoft.com/en-us/library/ms881875.aspx -> userlist
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      THANK YOU for your answer.

      fs-support_ZU wrote:

      How do you do other configuratons - can you add the commands there?

      We just run the WinNDCUCfg to make all neccessary registry settings and copy the files neccessary for the application into the FFSDISK folder. That's all.

      fs-support_ZU wrote:

      Why not?

      How can I use the WinNDCUCfg to set the usernames and passwords for the FTP?

      fs-support_ZU wrote:

      Not for the general system but for FTPD, refer msdn.microsoft.com/en-us/library/ms881875.aspx -> userlist

      This works fine for users without a Password. It would be exactly what I am looking for if I could set a password for each user. Is this possible? How?
      I used the registry entry and I tried to create a user with a password by setting this registry entry to "user:password". But this does not work.

      THANKS
      Dirk
      Hello,
      please refer fs-net.de/assets/download/docu…/en/NetDCU_FTP_Server.pdf and MSDN.
      How can I use the WinNDCUCfg to set the usernames and passwords for the FTP?
      In the same way a via nducfg, did you tried:
      "user create <user> <pw>" then set "AllowAnonymous" to zero.

      SAMPLE
      !>user create abc 123
      OK
      !>user create efg 124
      OK
      !>user enum
      User Configuration (LOCAL) \
      efg [M ] \
      abc [M ] \
      OK
      !>help user
      user create <name> <password>
      user delete <name>
      user enum
      OK
      You can create your own Interface using NTLM module.
      !>

      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.