This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCP/IP Client using Tm4c1294.

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.

  •       IP4_ADDR(&dest, 192, 168, 1, 115);

    Are you sure that this IP address (which is reserved for home/private network usage) is visible/allowed in your net ?

    I have to develop ...

    Sounds like a company/school environment - both of which are use to disallow such addresses.

    Check, if necessary with your network administrator, and try an address within your range.

  • Thank you f.m for your reply.

    I have tested the server by sending TCP/IP packet using Packet Sender Tool click Here.

    It shows the Connection Accepted as this:

    But nothing happens when I run my program.

    Kindly help.

  • But nothing happens when I run my program.

    The output "connection accepted", as seen in the sceenshot, shows that the TM4C client application basically works.

    But neither do I have such a TM4C129 board, nor do I have the time to debug it for you.

    The WireShark application (on PC side, AFAIK available for Windows and Linux), is useful to trace the IP traffic during debugging.

  • The output "connection accepted", as seen in the screenshot, shows that the TM4C client application basically works.

    The connection established when I send data packet using Packet sender tool and the server remain shows "waiting for incoming connection...." when my client application runs.

    .......nor do I have the time to debug it for you.

    Thank you for your reply once again.

    I am not getting any reply from TI employees, do I have to include some specific Tags to make them notice my post.