err_t TcpConnection::onSent(uint16_t len)
{
	debugf("TCP sent: %d", len);

	//debugf("%d %d", tcp->state, tcp->flags); // WRONG!
	if (len >= 0 && tcp != NULL && getAvailableWriteSize() > 0)
		onReadyToSendData(eTCE_Sent);

	return ERR_OK;
}
err_t TcpConnection::onReceive(pbuf *buf)
{
	if (buf == NULL)
		debugf("TCP received: (null)");
	else
		debugf("TCP received new: %d bytes", buf->tot_len);

	if (buf != NULL && getAvailableWriteSize() > 0)
		onReadyToSendData(eTCE_Received);

	return ERR_OK;
}
Example #3
0
err_t TcpConnection::onReceive(pbuf *buf)
{
	if (buf == NULL)
		debugf("TCP received: (null)");
	else
		debugf("TCP received: %d bytes", buf->tot_len);

	if (buf != NULL)
		onReadyToSendData(eTCE_Received);
	//else
	//	canSend = false;

	return ERR_OK;
}
err_t TcpConnection::onPoll()
{
	if (sleep >= timeOut && timeOut != 0xFFFF)
	{
		debugf("TCP connection closed by timeout: %d (from %d)", sleep, timeOut);

		close();
		return ERR_OK;
	}

	if (tcp != NULL && getAvailableWriteSize() > 0) //(tcp->state >= SYN_SENT && tcp->state <= ESTABLISHED))
		onReadyToSendData(eTCE_Poll);

	return ERR_OK;
}
err_t TcpConnection::onConnected(err_t err)
{
	if (err != ERR_OK)
		debugf("TCP connected error status: %d", err);
	else
		debugf("TCP connected");

	canSend = true;
	if (err == ERR_OK)
		onReadyToSendData(eTCE_Connected);
	else
		close();

	return ERR_OK;
}
Example #6
0
err_t TcpConnection::onPoll()
{
	if (sleep >= timeOut && timeOut != USHRT_MAX)
	{
		debugf("TCP connection closed by timeout: %d (from %d)", sleep, timeOut);

		close();
		return ERR_OK;
	}

	if (tcp != NULL && canSend) //(tcp->state >= SYN_SENT && tcp->state <= ESTABLISHED))
		onReadyToSendData(eTCE_Poll);

	return ERR_OK;
}