Home > Software engineering >  Linux under the ioctl rewritten to Windows here how to change
Linux under the ioctl rewritten to Windows here how to change

Time:09-22

 
Int iFd.
Struct ifreq ifr.

IFd=socket (AF_INET, SOCK_DGRAM, 0);
If (iFd==1)
{
Printf (" create socket failed!" );
Return UBTEDU_RC_SOCKET_NORESOURCE;
}

Strcpy (ifr) ifr_name, "wlan0");
If (ioctl (iFd SIOCGIFBRDADDR, & amp; Ifr) & lt; 0)//get the IP addr
{
Printf (" IP ioctl error!" );
Return UBTEDU_RC_SOCKET_FAILED;
}

Linux side blank, and then is not very understand, he is how do you determine the radio to receive is I'm going to the computer's IP, rather than other things?

CodePudding user response:

Recvfrom () function has a SOCKADDR structure, there are IP/PORT

CodePudding user response:

Setsockopt () supports the following options, of which the type of data referred to in "type" show optval,
Option type meaning
SO_BROADCAST BOOL allows the interface transfer broadcasting information,
SO_DEBUG BOOL record debugging information,
SO_DONTLINER BOOL don't block the closing because the data is not sent, set this option is equivalent to the SO_LINGER l_onoff elements is zero,
SO_DONTROUTE BOOL banned optional diameter; Direct transmission,
SO_KEEPALIVE BOOL to send "keep activity" package,
SO_LINGER struct linger FAR * if you have not send data shut down, stay,
SO_OOBINLINE BOOL receiving out-of-band data in the conventional data flow,
The SO_RCVBUF int for the receive buffer size is determined,
SO_REUSEADDR BOOL allows set of interfaces and a has been in the use of address binding (see bind ()),
SO_SNDBUF int the send buffer size is specified,
TCP_NODELAY BOOL prohibit send Nagle algorithm of merger,
  • Related