MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / get_socket

Function get_socket

components/net/lwip/lwip-1.4.1/src/api/sockets.c:194–214  ·  view source on GitHub ↗

* Map a externally used socket index to the internal socket representation. * * @param s externally used socket index * @return struct lwip_sock for the socket or NULL if not found */

Source from the content-addressed store, hash-verified

192 * @return struct lwip_sock for the socket or NULL if not found
193 */
194static struct lwip_sock *
195get_socket(int s)
196{
197 struct lwip_sock *sock;
198
199 if ((s < 0) || (s >= NUM_SOCKETS)) {
200 LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", s));
201 set_errno(EBADF);
202 return NULL;
203 }
204
205 sock = &sockets[s];
206
207 if (!sock->conn) {
208 LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): not active\n", s));
209 set_errno(EBADF);
210 return NULL;
211 }
212
213 return sock;
214}
215
216/**
217 * Same as get_socket but doesn't set errno

Callers 15

lwip_acceptFunction · 0.70
lwip_bindFunction · 0.70
lwip_closeFunction · 0.70
lwip_connectFunction · 0.70
lwip_listenFunction · 0.70
lwip_recvfromFunction · 0.70
lwip_sendFunction · 0.70
sockets.cFile · 0.70
event_callbackFunction · 0.70
lwip_shutdownFunction · 0.70
lwip_getaddrnameFunction · 0.70
lwip_getsockoptFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected