{"action":"closed","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/1260","repository_url":"https://api.github.com/repos/arduino/Arduino","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/1260/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/1260/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/1260/events","html_url":"https://github.com/arduino/Arduino/issues/1260","id":10545342,"number":1260,"title":"A proposal for more than one client in the Ethernet Shield acting as a server.","user":{"login":"carlosdelfino","id":369056,"avatar_url":"https://avatars.githubusercontent.com/u/369056?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosdelfino","html_url":"https://github.com/carlosdelfino","followers_url":"https://api.github.com/users/carlosdelfino/followers","following_url":"https://api.github.com/users/carlosdelfino/following{/other_user}","gists_url":"https://api.github.com/users/carlosdelfino/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosdelfino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosdelfino/subscriptions","organizations_url":"https://api.github.com/users/carlosdelfino/orgs","repos_url":"https://api.github.com/users/carlosdelfino/repos","events_url":"https://api.github.com/users/carlosdelfino/events{/privacy}","received_events_url":"https://api.github.com/users/carlosdelfino/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/arduino/Arduino/labels/Library:%20Ethernet","name":"Library: Ethernet","color":"000000"}],"state":"closed","locked":false,"assignee":{"login":"cmaglie","id":423515,"avatar_url":"https://avatars.githubusercontent.com/u/423515?v=3","gravatar_id":"","url":"https://api.github.com/users/cmaglie","html_url":"https://github.com/cmaglie","followers_url":"https://api.github.com/users/cmaglie/followers","following_url":"https://api.github.com/users/cmaglie/following{/other_user}","gists_url":"https://api.github.com/users/cmaglie/gists{/gist_id}","starred_url":"https://api.github.com/users/cmaglie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmaglie/subscriptions","organizations_url":"https://api.github.com/users/cmaglie/orgs","repos_url":"https://api.github.com/users/cmaglie/repos","events_url":"https://api.github.com/users/cmaglie/events{/privacy}","received_events_url":"https://api.github.com/users/cmaglie/received_events","type":"User","site_admin":false},"assignees":[{"login":"cmaglie","id":423515,"avatar_url":"https://avatars.githubusercontent.com/u/423515?v=3","gravatar_id":"","url":"https://api.github.com/users/cmaglie","html_url":"https://github.com/cmaglie","followers_url":"https://api.github.com/users/cmaglie/followers","following_url":"https://api.github.com/users/cmaglie/following{/other_user}","gists_url":"https://api.github.com/users/cmaglie/gists{/gist_id}","starred_url":"https://api.github.com/users/cmaglie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmaglie/subscriptions","organizations_url":"https://api.github.com/users/cmaglie/orgs","repos_url":"https://api.github.com/users/cmaglie/repos","events_url":"https://api.github.com/users/cmaglie/events{/privacy}","received_events_url":"https://api.github.com/users/cmaglie/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2013-02-01T16:13:30Z","updated_at":"2016-07-12T13:22:20Z","closed_at":"2016-07-12T13:22:20Z","body":"Hello\r\n\r\nEnjoying the post of @DavyLandman, I would make a small change I made in the function:\r\n\r\nEthernetClient EthernetServer :: available ()\r\n\r\nEthernetServer class.\r\n\r\nThe change function gives the possibility of obtaining more than one customer when using a server. Every call this having a new customer is returned, reserving for the sock that is not used until it is released when the customer receives the signal stop (), this releases the sock is worn allowing its use again.\r\n\r\nI am doing some tests with my fork Ethernet library and the Arduino which focuses on the use of threads based on DuinOS / FreeRTOS, and would like to invite you to test my changes together with those already made​​, so I can also their experience.\r\n\r\nI realized that the current library does not allow more than one client concurrently, and then I made a small change that is not yet finished and well tested, but it is helping me in my tests.\r\n\r\nThe code is not yet final, but is enough for a proposal for a new approach in obtaining the clients connected to a server.\r\n\r\nPrincipal function affected:\r\n    EthernetClient EthernetServer::available()\r\n    {\r\n      accept();\r\n    \r\n      for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {\r\n    \t  if(Ethernet.isSocketFree(sock)){\r\n    \t\t  EthernetClient client(sock);\r\n    \t\t  if (EthernetClass::_server_port[sock] == _port &&\r\n    \t\t\t\t  (client.status() == SnSR::ESTABLISHED ||\r\n    \t\t\t\t  client.status() == SnSR::CLOSE_WAIT)) {\r\n    \t\t\t  if (client.available()) {\r\n    \t\t\t\t  // XXX: don't always pick the lowest numbered socket.\r\n    \t\t\t\t  Ethernet.useSocket(sock);\r\n    \t\t\t\t  return client;\r\n    \t\t\t  }\r\n    \t\t  }\r\n    \t  }\r\n      }\r\n    \r\n      return EthernetClient(MAX_SOCK_NUM);\r\n    }\r\n\r\nFile Changed:\r\nhttps://github.com/carlosdelfino/Arduino/blob/ide-1.5.x/libraries/Ethernet/Ethernet.cpp \r\nhttps://github.com/carlosdelfino/Arduino/blob/ide-1.5.x/libraries/Ethernet/Ethernet.h\r\nhttps://github.com/carlosdelfino/Arduino/blob/ide-1.5.x/libraries/Ethernet/EthernetClient.cpp\r\nhttps://github.com/carlosdelfino/Arduino/blob/ide-1.5.x/libraries/Ethernet/EthernetServer.cpp\r\nhttps://github.com/carlosdelfino/Arduino/blob/ide-1.5.x/libraries/Ethernet/EthernetServer.h\r\n\r\nps.\r\n@DavyLandman, I removed the previous post and created a new discussion."}}
{"actor":{"display_login":"agdl"}}