public STUNMessage SendRecvSTUN(IPEndPoint epStun, STUNMessage msgRequest, int nTimeout) { STUNRequestResponse req = new STUNRequestResponse(msgRequest); lock (StunLock) { StunRequestResponses.Add(req); } SendSTUNMessage(msgRequest, epStun); req.WaitForResponse(nTimeout); return(req.ResponseMessage); }
public STUNMessage SendRecvSTUN1(EndPoint epStun, STUN2Message msgRequest, int nTimeout) { STUNRequestResponse req = new STUNRequestResponse(msgRequest); lock (StunLock) { StunRequestResponses.Add(req); } SendSTUNMessage(msgRequest, epStun); bool bResponse = req.WaitForResponse(nTimeout); lock (StunLock) { if (StunRequestResponses.Contains(req) == true) { StunRequestResponses.Remove(req); } } return(req.ResponseMessage); }