WebNMS Developer Forums
Click on Join Now to Sign Up
Hi,
I am using Agent Toolkit C Edition for Trial. I have a question regarding closing and opneing of UDP socket.
The problem is that If I have to support HA(High Availability) in my card. In case if my card goes down and SNMP is closed. I need to restart it immediately. Thus the UDP socket which is 8001 here needs to be closed and opened immediately. In our case socket is taking too long to be closed and available for opening again.
Could you please explain what could be the reason behind this behaviour?
Hi,
I here with sending the fix for this issue. Kindly replace the file "udpsock.c" under
<projectname>/agent/source/system/src directory.
recompile the source ( already generated source ).
Now test the same and let us know. Kindly send in your reply to our support ( cagent-support@webnms.com ) where we can able to track your request in a better way.
Thanks and Regards,
- subarayan -
(C-Agent Support)
Hi Subarayan,
I reviewed the file. There is no code change for retstart socket. It has code for NUCLEUS OS and IPV6 support.
I guess this won't help fix my issue. Please let me know the piece of code if you have provided the fix explicitly for the issue I am facing.
The attached file udpsock.c has the commented text as follows in the function OpenUdpSocket() in which AdventNet comment falls under #else part of #ifdef NUCLEUS_OS
See the below code snippet which was copied from the udpsock.c
#ifdef NUCLEUS_OS
struct addr_struct serverAddr;
int i;
CHAR *ptr;
int NU_FAIL = 0;
int retVal;
int sockFd;
#else
/* AdventNet Changes - Starts */
INT32 p = 1;
/* AdventNet Changes - Ends */
SOCKET sockFd;
Simillarly another code snippet is also present as mentioned below which falls under else part of both
NUCLEUS_OS as well as IPV6 like the below mentioned structure.
#ifdef NUCLEUS_OS
#else
#ifdef IPV6
#else
/* AdventNet Changes - Starts */
#ifdef WINDOWS
if(setsockopt(sockFd,SOL_SOCKET,SO_EXCLUSIVEADDRUSE,(CHAR *)&p,sizeof(INT32)))
#else
if(setsockopt(sockFd,SOL_SOCKET,SO_REUSEADDR,(CHAR *)&p,sizeof(INT32)))
#endif
{
DEBUGMSG1("UDP :: setsockopt fails to set the option SO_REUSEADDR\n");
}
/* AdventNet Changes - Ends */
endif /* NOT ipv6 */
endif /* NOT a NUCLEUS_OS */
Hope this helps. Do revert back to us for further support.
thanks and regards,
- subarayan -