MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / stop

Method stop

Arduino/libraries/Ethernet2/src/EthernetClient.cpp:126–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void EthernetClient::stop() {
127 if (_sock == MAX_SOCK_NUM)
128 return;
129
130 // attempt to close the connection gracefully (send a FIN to other side)
131 disconnect(_sock);
132 unsigned long start = millis();
133
134 // wait a second for the connection to close
135 while (status() != SnSR::CLOSED && millis() - start < 1000)
136 delay(1);
137
138 // if it hasn't closed, close it forcefully
139 if (status() != SnSR::CLOSED)
140 close(_sock);
141
142 EthernetClass::_server_port[_sock] = 0;
143 _sock = MAX_SOCK_NUM;
144}
145
146uint8_t EthernetClient::connected() {
147 if (_sock == MAX_SOCK_NUM) return 0;

Callers

nothing calls this directly

Calls 2

disconnectFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected