Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Socket Communication - Server with 2 different clients Pin
Richard MacCutchan25-Sep-13 1:01
mveRichard MacCutchan25-Sep-13 1:01 
GeneralRe: Socket Communication - Server with 2 different clients Pin
manoharbalu25-Sep-13 2:24
manoharbalu25-Sep-13 2:24 
GeneralRe: Socket Communication - Server with 2 different clients Pin
Richard MacCutchan25-Sep-13 2:59
mveRichard MacCutchan25-Sep-13 2:59 
GeneralRe: Socket Communication - Server with 2 different clients Pin
manoharbalu25-Sep-13 19:12
manoharbalu25-Sep-13 19:12 
GeneralRe: Socket Communication - Server with 2 different clients Pin
Richard MacCutchan25-Sep-13 21:28
mveRichard MacCutchan25-Sep-13 21:28 
GeneralRe: Socket Communication - Server with 2 different clients Pin
manoharbalu25-Sep-13 22:11
manoharbalu25-Sep-13 22:11 
GeneralRe: Socket Communication - Server with 2 different clients Pin
Richard MacCutchan25-Sep-13 22:21
mveRichard MacCutchan25-Sep-13 22:21 
GeneralRe: Socket Communication - Server with 2 different clients Pin
manoharbalu26-Sep-13 3:36
manoharbalu26-Sep-13 3:36 
I am agree that I am using separate objects (one for each port number) to listen on. But the problem is when the client requests a connection in object_2 at port number_2 (both object_1 and Object_2 are objects of class CListenSocket) it triggers the event CListenSocket::OnAccept(int nErrorCode) which in turn calls m_pFrm->AcceptClients()
and inside the function I am calling both
(m_pSocket->Accept(*pSocket)) and (m_pSVRLisnSocket->Accept(*pSocket)).

What happens is it gets inside m_pSocket->Accept which in turn calls CSocket::Accept() and strucks inside the below loop inside the function while my application proceeds without connecting to the client
while (!CAsyncSocket::Accept(rConnectedSocket, lpSockAddr, lpSockAddrLen))
{
if (GetLastError() == WSAEWOULDBLOCK)
{
if (!PumpMessages(FD_ACCEPT))
return FALSE;
}
else
return FALSE;
}

I thought that it will not take (m_pSocket->Accept(*pSocket)) but will call
(m_pSVRLisnSocket->Accept(*pSocket)) since this object_2 (m_pSVRLisnSocket) is getting the client request.


Please help me to find out what is causing the problem and how to resolve it.
GeneralRe: Socket Communication - Server with 2 different clients Pin
Richard MacCutchan26-Sep-13 4:20
mveRichard MacCutchan26-Sep-13 4:20 
GeneralRe: Socket Communication - Server with 2 different clients Pin
koll Zhu25-Sep-13 16:17
koll Zhu25-Sep-13 16:17 
AnswerRe: Socket Communication - Server with 2 different clients Pin
Richard MacCutchan25-Sep-13 21:17
mveRichard MacCutchan25-Sep-13 21:17 
AnswerRe: Socket Communication - Server with 2 different clients Pin
Malli_S25-Sep-13 2:24
Malli_S25-Sep-13 2:24 
QuestionClarification regarding the function CAsyncSocket::GetPeerName() Pin
manoharbalu25-Sep-13 0:14
manoharbalu25-Sep-13 0:14 
AnswerRe: Clarification regarding the function CAsyncSocket::GetPeerName() Pin
Richard MacCutchan25-Sep-13 0:22
mveRichard MacCutchan25-Sep-13 0:22 
GeneralRe: Clarification regarding the function CAsyncSocket::GetPeerName() Pin
manoharbalu25-Sep-13 0:48
manoharbalu25-Sep-13 0:48 
Questionset the version Pin
koll Zhu24-Sep-13 23:29
koll Zhu24-Sep-13 23:29 
AnswerRe: set the version Pin
Richard MacCutchan25-Sep-13 0:23
mveRichard MacCutchan25-Sep-13 0:23 
GeneralRe: set the version Pin
koll Zhu25-Sep-13 0:46
koll Zhu25-Sep-13 0:46 
GeneralRe: set the version Pin
koll Zhu25-Sep-13 0:51
koll Zhu25-Sep-13 0:51 
QuestionRe: set the version Pin
Maximilien25-Sep-13 8:03
Maximilien25-Sep-13 8:03 
AnswerRe: set the version Pin
koll Zhu25-Sep-13 16:06
koll Zhu25-Sep-13 16:06 
Questiondoes listivew_???? make handles leak...? Pin
JoneLe8624-Sep-13 19:10
JoneLe8624-Sep-13 19:10 
QuestionMFC PreTranslateMessage walks opposite the documentation. Pin
Vaclav_24-Sep-13 9:04
Vaclav_24-Sep-13 9:04 
AnswerRe: MFC PreTranslateMessage walks opposite the documentation. Pin
Randor 24-Sep-13 11:03
professional Randor 24-Sep-13 11:03 
QuestionHow to get Ip Address and Port No MFC Sockets Pin
manoharbalu24-Sep-13 3:26
manoharbalu24-Sep-13 3:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.