U
USUN_TO
Hi, i got problem
when i bind in this way:
local_addr.sin_family = AF_INET;
local_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
local_addr.sin_port = htons(CLIENT_PORT);
i can easly bind port without any SIGSEGV (segmentation fault) but MSDN
wrote:
"If an application does not care what local address is assigned, specify
the manifest constant value ADDR_ANY for the sa_data member of the name
parameter. This allows the underlying service provider to use any
appropriate network address, potentially simplifying application
programming in the presence of multihomed hosts (that is, hosts that
have more than one network interface and address)."
so how write this? What is diference betwean ADDR_ANY and INADDR_ANY?
Thiese lines are wrong cause makes SIGSEGV:
local_addr.sin_addr.s_addr = htonl(ADDR_ANY);
local_addr.sin_addr.s_addr = htons(ADDR_ANY);
local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
local_addr.sin_addr.s_addr = htons(INADDR_ANY);
local_addr.sin_addr.s_addr = INADDR_ANY;
local_addr.sin_addr.s_addr = ADDR_ANY;
Plz help me...
when i bind in this way:
local_addr.sin_family = AF_INET;
local_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
local_addr.sin_port = htons(CLIENT_PORT);
i can easly bind port without any SIGSEGV (segmentation fault) but MSDN
wrote:
"If an application does not care what local address is assigned, specify
the manifest constant value ADDR_ANY for the sa_data member of the name
parameter. This allows the underlying service provider to use any
appropriate network address, potentially simplifying application
programming in the presence of multihomed hosts (that is, hosts that
have more than one network interface and address)."
so how write this? What is diference betwean ADDR_ANY and INADDR_ANY?
Thiese lines are wrong cause makes SIGSEGV:
local_addr.sin_addr.s_addr = htonl(ADDR_ANY);
local_addr.sin_addr.s_addr = htons(ADDR_ANY);
local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
local_addr.sin_addr.s_addr = htons(INADDR_ANY);
local_addr.sin_addr.s_addr = INADDR_ANY;
local_addr.sin_addr.s_addr = ADDR_ANY;
Plz help me...