Hi,
It looks like net-snmp will always reuse the port
on windows because of the following code:
#ifdef SO_REUSEADDR
/*
* Allow the same port to be specified multiple
times without failing.
* (useful for a listener)
*/
{
int one = 1;
setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR,
(void *) &one,
sizeof(one));
}
#endif /*SO_REUSEADDR */
On windows, SO_REUSEADDR is 0x0004 in header file
WinSock2.h. So this piece of code will always be
called. One problem caused by this is suppose we have
two net-snmp applications, they search the same port
pool in the same order, becuase of port reuse, the
second application has no way to know a port has
already been used by the first application since
netsnmp_udp_transport(struct sockaddr_in *addr, int
local) will return SUCCESS. As a result, both
applications can get weird results.
Does anyone know how to avoid this without
changing the source code?
Thanks,
Ying
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders