Пример #1
0
/*
 * Sends the real data in the current connection's virtual buffer
 */
void send() {

	uip_tcp_appstate_t *app = &(uip_conn->appstate);

	// Find the intersection of the virtual buffer and the real uip buffer
	int len = (int)app->cursor - app->ackedCount;
	len = len < 0 ? 0 : len;
	len = len > (int)uip_conn->mss ? (int)uip_conn->mss : len;

	if (verbose) {
		Serial.print("TX ");
		Serial.print(len);
		Serial.println(" bytes");
	}

#ifdef DEBUG
	Serial.print(app->ackedCount);
	Serial.print(" - ");
	Serial.print(app->ackedCount + len - 1);
	Serial.print(" of ");
	Serial.println((int)app->cursor);
#endif // DEBUG

	// Send the real bytes from the virtual buffer and record how many were sent
	uip_send(uip_appdata, len);
	app->sentCount = len;
	setTXPin(HIGH);
}
Пример #2
0
/*
 * Sends the real data in the current connection's virtual buffer
 */
void send() {

	uip_tcp_appstate_t *app = &(uip_conn->appstate);

	// Find the intersection of the virtual buffer and the real uip buffer
	int len = (int)app->cursor - app->ackedCount;
	len = len < 0 ? 0 : len;
	len = len > (int)uip_conn->mss ? (int)uip_conn->mss : len;

    #ifdef DEBUG
		DebugPrintFO(f_tx);		// Serial.print("-->TX ");
		Serial.print(len);
		DebugPrintF (f_bytes);	// Serial.print (" bytes");
        Serial.print(app->ackedCount);
        DebugPrintFO(f_hyphen);		// Serial.print(" - ");
        Serial.print(app->ackedCount + len - 1);
        DebugPrintFO(f_of);			// Serial.print(" of ");
        Serial.print((int)app->cursor);
        DebugPrint((char *)"");
    #endif // DEBUG

	// Send the real bytes from the virtual buffer and record how many were sent
	uip_send(uip_appdata, len);
	app->sentCount = len;
	setTXPin(HIGH);
}