Hello,
I have to develop a TCP Client and have followed the forum posts and modified the enet_io example.
The post is click here.
I have made the following changes:
// lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_AUTOIP); lwIPInit(g_ui32SysClock, pui8MACArray, (192u<<24)|(168u<<16)|(1<<8)|16,(255u<<24)|(255u<<16)|(255<<8)|0, (255u<<24)|(255u<<16)|(255<<8)|0, IPADDR_USE_STATIC);
as I am using static IP, so changed the following in lwipopts.h file
#define LWIP_DHCP 0//1 // default is 0 #define LWIP_AUTOIP 0// 1 // default is 0
Then I blocked the following lines:
// Setup the device locator service.
//
/* LocatorInit();
LocatorMACAddrSet(pui8MACArray);
LocatorAppTitleSet("EK-TM4C1294XL enet_io");
*/
//
// Initialize a sample httpd server.
//
// httpd_init();
//
// Pass our tag information to the HTTP server.
//
// http_set_ssi_handler((tSSIHandler)SSIHandler, g_pcConfigSSITags,NUM_CONFIG_SSI_TAGS);
//
// Pass our CGI handlers to the HTTP server.
//
// http_set_cgi_handlers(g_psConfigCGIURIs, NUM_CONFIG_CGI_URIS);
as I am using a Normal C server in VMware Workstation as this:
and finally I have included the Client_Init() function and uncomment
#define LWIP_RAW 1
in lwipopts.h file.
The code for Client_Init() is :
void Client_Init()
{
struct tcp_pcb *pcb;
struct ip_addr dest;
err_t ret_val;
IP4_ADDR(&dest, 192, 168, 1, 115);
pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY, 8888);
tcp_arg(pcb, NULL);
ret_val = tcp_connect(pcb, &dest, 8888, client_connected);
if (ret_val != ERR_OK)
{
UARTprintf("\tcp_connect(): Errors on return value, returned value is %d\n", ret_val);
SysCtlDelay(13333333);
}
else
{
UARTprintf("\Error: Errors on return value, returned value is %d\n", ret_val);
SysCtlDelay(13333333);
}
}
But it is unable to connect to the server.
Do I have to include or change something to make it work??
Thank you in advance.

