{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/1430","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/1430/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/1430/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/1430/events","html_url":"https://github.com/esp8266/Arduino/issues/1430","id":126740581,"number":1430,"title":"Again: TCP server performance completely unuseful","user":{"login":"nouser2013","id":6624032,"avatar_url":"https://avatars.githubusercontent.com/u/6624032?v=3","gravatar_id":"","url":"https://api.github.com/users/nouser2013","html_url":"https://github.com/nouser2013","followers_url":"https://api.github.com/users/nouser2013/followers","following_url":"https://api.github.com/users/nouser2013/following{/other_user}","gists_url":"https://api.github.com/users/nouser2013/gists{/gist_id}","starred_url":"https://api.github.com/users/nouser2013/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nouser2013/subscriptions","organizations_url":"https://api.github.com/users/nouser2013/orgs","repos_url":"https://api.github.com/users/nouser2013/repos","events_url":"https://api.github.com/users/nouser2013/events{/privacy}","received_events_url":"https://api.github.com/users/nouser2013/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-14T20:23:25Z","updated_at":"2016-01-16T23:32:08Z","closed_at":null,"body":"Hi, I'm sorry to bring this up once more as it has been referenced several times now. But still, I cannot get a TCP server to put more than one packet in the send queue due to incorrect handling of the delayed ACK. Looking at the headers, there is the TCP_MSS set to 1460 and the TCP_WND four times that value. Hence, if the same thing is in the liblwip.a (and negotiation works correctly), we shouldn't have a problem.\r\n\r\nWhat bothers me in particular is the following video https://www.youtube.com/watch?v=8ISbmQTbjDI where this guy sends websocket replies back to the client at about 220Hz. And they carry arrays of data. To be fair, he coded this with the FreeRTOS version without arduino intermediary layer.\r\n\r\nBUT: why can't we have this?\r\n\r\n```c\r\nWiFiServer tcpTelnetServer(23);\r\nWiFiClient tcpTelnetClient; // Only one client at a time a.t.m.!\r\n\r\nvoid setup() {\r\n  tcpTelnetServer.begin();\r\n}\r\n\r\nvoid loop() {\r\n  // HANDLE TCP TELNET SERVER\r\n  if (!tcpTelnetClient.connected()) {\r\n    tcpTelnetClient = tcpTelnetServer.available();\r\n    if (tcpTelnetClient.connected()) {\r\n      tcpTelnetClient.setNoDelay(true);\r\n      Serial.println(\" DBG: New TCP client connected...\");\r\n    }\r\n  } else {\r\n    // remember: Telnet sends \\r or \\r\\n, NOT \\n!\r\n    if (tcpTelnetClient.available()) {\r\n      char stringBuffer[300];\r\n      tcpTelnetClient.readBytesUntil('\\r', stringBuffer, sizeof(stringBuffer)-1);\r\n      tcpTelnetClient.flush();\r\n      // Process command...\r\n      for (int i=0; i<6; i++) {\r\n        memset(stringBuffer, 't', 60);\r\n        stringBuffer[60] = 0; // Zeroterminate manually!\r\n        Serial.printf(\"Before (%d): %d\\n\", i, micros());\r\n        tcpTelnetClient.print(stringBuffer);\r\n        Serial.printf(\"Middle (%d): %d\\n\", i, micros());\r\n        tcpTelnetClient.write((uint8_t *)stringBuffer, strlen(stringBuffer));\r\n        Serial.printf(\"After  (%d): %d\\n\\n\", i, micros());\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nthis results in\r\n```\r\nBefore (0): 46582971\r\nMiddle (0): 46785297\r\nAfter  (0): 46984893\r\n\r\nBefore (1): 46985136\r\nMiddle (1): 47393106\r\nAfter  (1): 47803031\r\n\r\nBefore (2): 47803275\r\nMiddle (2): 48212294\r\nAfter  (2): 48621882\r\n\r\nBefore (3): 48622126\r\nMiddle (3): 48827013\r\nAfter  (3): 49236314\r\n\r\nBefore (4): 49236558\r\nMiddle (4): 49647626\r\nAfter  (4): 49854952\r\n\r\nBefore (5): 49855141\r\nMiddle (5): 50054827\r\nAfter  (5): 50254701\r\n```\r\n\r\n*edit: MWE added.."},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/172272232","html_url":"https://github.com/esp8266/Arduino/issues/1430#issuecomment-172272232","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/1430","id":172272232,"user":{"login":"drmpf","id":5945337,"avatar_url":"https://avatars.githubusercontent.com/u/5945337?v=3","gravatar_id":"","url":"https://api.github.com/users/drmpf","html_url":"https://github.com/drmpf","followers_url":"https://api.github.com/users/drmpf/followers","following_url":"https://api.github.com/users/drmpf/following{/other_user}","gists_url":"https://api.github.com/users/drmpf/gists{/gist_id}","starred_url":"https://api.github.com/users/drmpf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drmpf/subscriptions","organizations_url":"https://api.github.com/users/drmpf/orgs","repos_url":"https://api.github.com/users/drmpf/repos","events_url":"https://api.github.com/users/drmpf/events{/privacy}","received_events_url":"https://api.github.com/users/drmpf/received_events","type":"User","site_admin":false},"created_at":"2016-01-16T23:32:08Z","updated_at":"2016-01-16T23:32:08Z","body":"_send_waiting was my suggestion.  Waiting on ivan, markus etc, to review the idea for inclusion.\r\n(https://github.com/esp8266/Arduino/issues/922)\r\n\r\nIn the mean time, a complete library  pfodESP2866WiFi   with examples is available from \r\nhttp://www.forward.com.au/pfod/pfodParserLibraries/index.html\r\nThis is a modified version of the ESP8266 V2.0.0 with files renamed so you can install it with the standard code without conflicts.\r\nThe modified library does two things \r\ni) buffers small sends for upto 10mS to reduce the number of short packets\r\nii) does not block if the packet can be sent immediately\r\niii) adds a method isSendWaiting() so you can check if a call to TCP send will block."}}