Hi,

>There is now a limitation of 64 sockets that sofia-sip can handle
>concurrently on win32. I have a few ides how to fix that, but it most
>probably would mean breaking the binary compatibility on win32. I hope
>that is not a major issue.

Here my experience in Win32

1) use select()
The default value of FD_SETSIZE is 64, which can be modified by defining

FD_SETSIZE to another value before including Winsock2.h

if we define the FD_SETSIZE to a 1024, select can serve 1024 socket
I've tested that and select works fine.

2) use WSAAsyncSelect()

Very bad idea, especially for server application

3)
> 1) use WSASelectEvents() but bind several sockets to a single event.
>The question is, is it possible to do that?

It's possible, we must use WSAEnumNetworkEvents for all sockets on
single event to check what socket have FD_ event

It's my test code


#define SOCKETS_PER_EVENT 64
        
int ret = 0, ii = 0;
SOCKET ListenSocket[SOCKETS_PER_EVENT];
WSAEVENT NewEvent;
sockaddr_in InetAddr;
WSANETWORKEVENTS NetworkEvents;


WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);

InetAddr.sin_family = AF_INET;
InetAddr.sin_addr.s_addr = htonl(INADDR_ANY);

NewEvent = WSACreateEvent();

for (ii=0; ii<SOCKETS_PER_EVENT; ii++)
{
        ListenSocket[ii] = socket(AF_INET, SOCK_STREAM, 0);
        InetAddr.sin_port = htons(40000 + ii);
        ret  = bind (ListenSocket[ii], (SOCKADDR *) &InetAddr,
sizeof(InetAddr));

        ret = WSAEventSelect( ListenSocket[ii], NewEvent, FD_ACCEPT |
FD_CLOSE);
        ret = listen(ListenSocket[ii], 5);
}

ret = WSAWaitForMultipleEvents(1, &NewEvent, TRUE, WSA_INFINITE, FALSE);


for (ii=0; ii<SOCKETS_PER_EVENT; ii++)
{
        ret = WSAEnumNetworkEvents(ListenSocket[ii], NewEvent,
&NetworkEvents);

        if (0 != NetworkEvents.lNetworkEvents)
        {
                // have FD_ event       
                ii = ii;
        }
}

Thanks.




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to