edk2 里面有个叫socket.c 的文件,里面实现了socket
//// Initialize the socket protocol//pSocket->Signature = SOCKET_SIGNATURE;pSocket->SocketProtocol.pfnAccept = EslSocketAccept;pSocket->SocketProtocol.pfnBind = EslSocketBind;pSocket->SocketProtocol.pfnClosePoll = EslSocketClosePoll;pSocket->SocketProtocol.pfnCloseStart = EslSocketCloseStart;pSocket->SocketProtocol.pfnConnect = EslSocketConnect;pSocket->SocketProtocol.pfnGetLocal = EslSocketGetLocalAddress;pSocket->SocketProtocol.pfnGetPeer = EslSocketGetPeerAddress;pSocket->SocketProtocol.pfnListen = EslSocketListen;pSocket->SocketProtocol.pfnOptionGet = EslSocketOptionGet;pSocket->SocketProtocol.pfnOptionSet = EslSocketOptionSet;pSocket->SocketProtocol.pfnPoll = EslSocketPoll;pSocket->SocketProtocol.pfnReceive = EslSocketReceive;pSocket->SocketProtocol.pfnShutdown = EslSocketShutdown;pSocket->SocketProtocol.pfnSocket = EslSocket;pSocket->SocketProtocol.pfnTransmit = EslSocketTransmit;pSocket->MaxRxBuf = MAX_RX_DATA;pSocket->MaxTxBuf = MAX_TX_DATA;//// Install the socket protocol on the specified handle//Status = gBS->InstallMultipleProtocolInterfaces (pChildHandle,&gEfiSocketProtocolGuid,&pSocket->SocketProtocol,NULL);