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

Function get_socket

components/net/lwip/lwip-2.1.2/src/api/sockets.c:497–509  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

495 * @return struct lwip_sock for the socket or NULL if not found
496 */
497static struct lwip_sock *
498get_socket(int fd)
499{
500 struct lwip_sock *sock = tryget_socket(fd);
501 if (!sock) {
502 if ((fd < LWIP_SOCKET_OFFSET) || (fd >= (LWIP_SOCKET_OFFSET + NUM_SOCKETS))) {
503 LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", fd));
504 }
505 set_errno(EBADF);
506 return NULL;
507 }
508 return sock;
509}
510
511/**
512 * Allocate a new socket for a given netconn.

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_recvmsgFunction · 0.70
lwip_sendFunction · 0.70
lwip_sendmsgFunction · 0.70
lwip_sendtoFunction · 0.70
event_callbackFunction · 0.70
lwip_shutdownFunction · 0.70

Calls 1

tryget_socketFunction · 0.70

Tested by

no test coverage detected