Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed the week of November 23.

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.

CCS/TM4C1294NCPDT: TI-RTOS UDP close

Part Number: TM4C1294NCPDT

Tool/software: Code Composer Studio

MCU: TM4C1294NCPDT

RTOS version : tirtos_tivac_2_16_01_14

NDK version : ndk_2_25_00_09

Hi

I have some problem.

UDP sento failed and socket close crash.

When sento failed and i using fdClose(fd), but MCU has no response anymore.

I using debug tool, find a problem.

Seems into a infinite loop here.

hIf = BindIPHost2IF ((IPN)ptr_ipmreq->imr_interface.s_addr);
if (!hIf)
return (EINVAL);

This is my code UDP socket:

int fd = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

	if (fd < 0) {
		return -1;
	}
	struct ip_mreq mreq;
	struct sockaddr_in sa = {0};

	int enable = 1;
	int hops = 255;

	if (setsockopt((SOCKET)fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable))) {
		goto err;
    }
    if (setsockopt((SOCKET)fd, SOL_SOCKET, SO_REUSEPORT, &enable, sizeof(enable))) {
		goto err;
    }
    if (setsockopt((SOCKET)fd, SOL_SOCKET, SO_BROADCAST, &enable, sizeof(enable))) {
   		goto err;
    }

	if (setsockopt((SOCKET)fd, IPPROTO_IP, IP_TTL, &hops, sizeof(hops))) {
		goto err;
	}

	mreq.imr_multiaddr.s_addr = htonl(0xE00000FB);
	mreq.imr_interface = interface_addr;
	if (setsockopt((SOCKET)fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq))) {
		goto err;
	}

	sa.sin_family = AF_INET;
	sa.sin_port = ntohs(5353);
	sa.sin_addr.s_addr = INADDR_ANY;

	if (bind((SOCKET)fd, (struct sockaddr*) &sa, sizeof(sa))) {
		goto err;
	}

	send_addr->sin_family = AF_INET;
	send_addr->sin_addr.s_addr = mreq.imr_multiaddr.s_addr;
	send_addr->sin_port = ntohs(5353);

How do i check what's problem?

Allen