Lines Matching defs:nFd
76 int nFd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
77 if (nFd == -1) {
81 *sockFd = nFd;
180 int nFd = -1;
181 if (CreateRawSocket(&nFd) != SOCKET_OPT_SUCCESS) {
189 close(nFd);
197 if (bind(nFd, (struct sockaddr *)&rawAddr, sizeof(rawAddr)) == -1) {
198 close(nFd);
206 close(nFd);
222 close(nFd);
233 ssize_t nBytes = sendto(nFd, &udpPackets, sendLen, 0, (struct sockaddr *)&rawAddr, sizeof(rawAddr));
237 optionLen, sendLen, dhcpPackLen, nFd, errno);
241 optionLen, sendLen, dhcpPackLen, nFd, destIndex, static_cast<int>(nBytes));
243 close(nFd);
249 int nFd = -1;
250 if ((CreateKernelSocket(&nFd) != SOCKET_OPT_SUCCESS) ||
251 (BindKernelSocket(nFd, NULL, srcIp, BOOTP_CLIENT, false) != SOCKET_OPT_SUCCESS)) {
252 DHCP_LOGE("SendDhcpPacket fd:%{public}d failed!", nFd);
258 close(nFd);
264 int nRet = connect(nFd, (struct sockaddr *)&kernelAddr, sizeof(kernelAddr));
266 DHCP_LOGE("SendDhcpPacket nFd:%{public}d failed, connect error:%{public}d.", nFd, errno);
267 close(nFd);
271 ssize_t nBytes = write(nFd, sendPacket, sizeof(struct DhcpPacket));
273 DHCP_LOGE("SendDhcpPacket fd:%{public}d failed, write error:%{public}d.", nFd, errno);
275 DHCP_LOGI("SendDhcpPacket fd:%{public}d, bytes:%{public}d.", nFd, static_cast<int>(nBytes));
277 close(nFd);