Example #1
0
static int8 sock_put(uint8 sock)
{
	DBGCRTCA(sock<ATC_SOCK_NUM_START||sock>ATC_SOCK_NUM_END, "wrong sock(%d)", sock);

	if(sockstat[sock] & SOCK_STAT_UDP) {
		udpip[sock][0] = udpip[sock][1] = udpip[sock][2] = 0;
		udpip[sock][3] = udpport[sock] = 0;
	}
	sockstat[sock] = SOCK_STAT_IDLE;
	sockport[sock] = 0;
	sockwatch_clr(sock, WATCH_SOCK_ALL_MASK);
	return RET_OK;
}
Example #2
0
/**
 * Remove callback function from a socket and Stop to watch all event.
 *
 * @ingroup sockwatch_module
 * @param sock The socket number to close
 * @return RET_OK: Success
 * @return RET_NOK: Error
 */
int8_t sockwatch_close(uint8_t sock)
{
	DBGA("WATCH Close - sock(%d)", sock);
	if(sock >= TOTAL_SOCK_NUM) {
		ERRA("wrong sock(%d)", sock);
		return RET_NOK;
	}

	sockwatch_clr(sock, WATCH_SOCK_ALL_MASK);
	watch_cb[sock] = NULL;

	return RET_OK;
}