PDA

View Full Version : multime binds, possible?


emihaly
04-28-2003, 02:06 PM
hi, is this possible or i must for each specify different serv_addr struct?
later i swich it to unblock.

serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(15002);

if (bind(reset_socket,(struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
{
reportlog("BINDING: Assigning a name to a socket Error fail");
return 0;
}

serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(15003);

if (bind(reload_socket,(struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
{
reportlog("BINDING: Assigning a name to a socket Error fail");
return 0;
}

serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(15004);

if (bind(status_socket,(struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
{
reportlog("BINDING: Assigning a name to a socket Error fail");
return 0;
}

RobSeace
04-28-2003, 07:03 PM
Sure, I don't see any problem with that... The sockaddr passed
to bind() isn't needed after the bind() is done, for any reason...
So, there should be no problem with reusing it for something else...
Why, are you saying it's not working??

emihaly
04-29-2003, 07:01 AM
no, it wokr, but i try get out of future trouble. For example, when is fill timeout struct for select and use it in select , on end, clear it this struct. I dont dont know why. I must fill struct in every cycle.

I think, if someone want best performance server, it must rewrite tcpip engine in kerenl for own usage. I look in tcpip and its little ineficient. for example, i dont know why nagle on/of havent own function like NagleSwich or like other name. i look on setsock opt source and it use swich code with other check and this is little ineficient, becose handle lot of action what i neevr usage. Lot of command of tcpip is the same. I think, good developer can improve tcpip over 10 percent and this is very well on 1 GB network.