TI中文支持网
TI专业的中文技术问题搜集分享网站

MSP432E401Y: telnet功能如何启用

Part Number:MSP432E401Y

我使用的SDK是simplelink_msp432e4_sdk_4_20_00_12,想要启用telnet功能,请问该要如何配置,包括IP,端口等

Ben Qin:

你好,为了更好的解决您的问题,我将咨询TI相关资深工程师,一旦有回复会立即回复您。

,

Ben Qin:

你好,由于内容比较多,请点击下面的链接来查看工程师的回复:

e2e.ti.com/…/4554063

,

Ryan Sun:

Hi Ben,

How can I get the telnet callback function? Is there any demo?

Thanks

,

Ben Qin:

下面是工程师的回复:

If you mean the service report callback, I just tweaked the one from the other TCP demos:

/** @brief Service report callback.** May be set as the callback for various network config operation that are defined in the GUI.*/
void serviceReport(uint32_t item, uint32_t status, uint32_t report, void *h)
{static char *taskName[] = {"Telnet", "", "NAT", "DHCPS", "DHCPC", "DNS"};static char *reportStr[] = {"", "Running", "Updated", "Complete", "Fault"};static char *statusStr[] = {"Disabled", "Waiting", "IPTerm", "Failed","Enabled"};Display_printf(display, 0, 0, "Service Status: %-9s: %-9s: %-9s: %03d\n",taskName[item - 1], statusStr[status], reportStr[report / 256],report & 0xFF);/* report common system issues */if ((item == CFGITEM_SERVICE_DHCPCLIENT) &&(status == CIS_SRV_STATUS_ENABLED) &&(report & NETTOOLS_STAT_FAULT)){Display_printf(display, 0, 0, "DHCP Client initialization failed; check your network.\n");while (1);}
}

,

Ryan Sun:

Hi Ben,

It seems that the PC can link to device successfully but the device cannot enable Telnet service. I enter ”telnet 192.168.1.100 1000“ in Wndows Terminal like picture_1. 

After hitting Enter key, it becoms shown in picture_2. 

Throughout the process, I used WireShark tools to capture packets and the result is shown as picture_3. Please help to check it.

My PC IP is 192.168.1.20 and the device IP is 192.168.1.100. The Telnet port number is 1000.

Thanks~

,

Ryan Sun:

Hi Ben,

I change the Telnet port in a file name tcpEchoHooks.c like below. I don't use syscfg GUI

There is not any log from the UART console when doing Telnet linking.

,

Ben Qin:

Hi Ryan,

I followed up with the e2e engineer.

Regards,

Ben

,

Ben Qin:

Hi Ryan,

Ah, I can see why you might expect that to work, however:

Many of the sample projects use netIPAddrHook() to start a network task, with a hard coded port number, when an IP address has first been assigned.

Telnet is a service, so is started differently. When you check Telnet in the syscfg GUI, the following code is added to the generated code file ti_ndk_config.c. Here, the port number (telnet.param.Port = 23;) is generated according to the port parameter from the GUI Telnet settings.

/** ======== ti_ndk_config_telnet_init ========* Configure and initialize Telnet server(s)*/extern SOCKET ConsoleOpen(struct sockaddr *pSinClient);

static void ti_ndk_config_telnet_init(void *hCfg){    CI_SERVICE_TELNET telnet;

    /* Specify Telnet service for Telnet instance: CONFIG_TELNETS_0 */    /* NOTE! The application must provide the service report function matching this prototype! */

    extern void serviceReport(uint32_t item, uint32_t status,    uint32_t report, void *h);

    memset(&telnet, 0, sizeof(telnet));    telnet.cisargs.Mode = CIS_FLG_CALLBYIP;    telnet.cisargs.IPAddr = inet_addr("0.0.0.0");    telnet.cisargs.pCbSrv = serviceReport;    telnet.param.MaxCon = 8;    telnet.param.Port = 23;    telnet.param.Callback = &ConsoleOpen;

    CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_TELNET, 0, sizeof(telnet), (unsigned char *)&telnet, 0);}

If you edit this, it will get overwritten but I would recommend sticking with 23, at least until you get something working.

If you have added the service report function to the Telnet setting (like the sample I posted yesterday), you should get some message about Telnet (enabled or failed). Until it reports "enabled", you are not going to be able to connect.

Best regardsJim

,

Ben Qin:

Hi Ryan,

Saw your reply on e2e, please pay attention on e2e response, I'll close this thread.

Thanks!

,

Ryan Sun:

Hi Ben,

Thank you for your help!

赞(0)
未经允许不得转载:TI中文支持网 » MSP432E401Y: telnet功能如何启用
分享到: 更多 (0)