int k = 1;
if( SUCCESS != m_socketServer.setSockOptSocket( SO_REUSEADDR, (char*)&k, sizeof(k), SOL_SOCKET ) ) {
PRINT("setSockOptSocket SO_REUSEADDR error\n");
}
linger m_sLinger;
m_sLinger.l_onoff = 1;
m_sLinger.l_linger = 0;
if( SUCCESS != m_socketServer.setSockOptSocket( SO_LINGER, (char*)&m_sLinger, sizeof(m_sLinger), SOL_SOCKET ) ) {
PRINT("setSockOptSocket SO_LINGER error\n");
}
时间: 2024-11-02 07:07:59