Click here to Skip to main content
15,029,162 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to update edit controls???? Pin
Hamid_RT28-Jun-06 21:21
MemberHamid_RT28-Jun-06 21:21 
GeneralRe: how to update edit controls???? Pin
ovidiucucu28-Jun-06 21:31
Memberovidiucucu28-Jun-06 21:31 
GeneralRe: how to update edit controls???? Pin
thathvamsi28-Jun-06 23:05
Memberthathvamsi28-Jun-06 23:05 
AnswerRe: how to update edit controls???? [modified] Pin
ovidiucucu29-Jun-06 1:12
Memberovidiucucu29-Jun-06 1:12 
GeneralRe: how to update edit controls???? Pin
thathvamsi29-Jun-06 17:47
Memberthathvamsi29-Jun-06 17:47 
QuestionHow to replace HTML img into Text? [modified] Pin
Tcpip200528-Jun-06 17:23
MemberTcpip200528-Jun-06 17:23 
AnswerRe: How to replace HTML img into Text? Pin
Viorel.28-Jun-06 21:02
MemberViorel.28-Jun-06 21:02 
Questionsocket WSAWaitForMultipleEvents trouble [modified] Pin
raserove28-Jun-06 17:11
Memberraserove28-Jun-06 17:11 
Hi Guys,
Thanks for answering my earlier post about socket trouble. The trouble is my server stopped listening for new connections (Connrefused error when client connects) but old connections are alive & still receiving handshakes.

Clients couldn't get connected even hr's after. I've found the reason, my server works fine if connections arrives one by one, but when simultaneous connections arrive, the events(WSAWaitForMultipleEvents) which i used in loop stops triggering. Without events the server works fine (accepts simultaneous connections).

I'm posting crtical section of my code, could some one give me a possible solutions...

//code starts
s = socket(AF_INET,SOCK_STREAM,0); //created
bind(s,...) == SOCKET_ERROR ) //bind
listen(s,SOMAXCONN) == SOCKET_ERROR ) //listen
CClientThread *newclient;

//The following lines are causing truble when many connections arrive simultaneously, suspect WSAWaitForMultipleEvents

WSAEVENT hEvent1 = WSACreateEvent();
WSAEventSelect (server_socket, hEvent1, FD_ACCEPT);

WSAEVENT pEvents[2];
pEvents[0] = hEvent1; // Socket event
pEvents[1] = GetStopEvent(); // Thread teminate event

BOOL bDone = false;

while ( !bDone)
{

int nRetVal = ::WSAWaitForMultipleEvents(2, pEvents, FALSE, 0, FALSE);

switch (nRetVal)
{ //when too many connections arrive at a time, this case never triggers
case WSA_WAIT_EVENT_0:

// Connection to accept
SOCKET client_socket;
client_socket = accept(s,,...);

if ( client_socket == INVALID_SOCKET )
closesocket(client_socket);
return(0);
}

newclient = new CClientThread(this,client_socket,client_ip, iPort);

newclient->StartThread();

WSAResetEvent (hEvent1);

break;
case WSA_WAIT_EVENT_0+1:
bDone = TRUE; // Thread requested to stop
break;
case WSA_WAIT_TIMEOUT:
break; // Timeout
}

}
WSACloseEvent (hEvent1);
//Code ends
Thank you

Rove

-- modified at 23:32 Wednesday 28th June, 2006
QuestionHow to create a virtual printer? Pin
yanping wang28-Jun-06 16:50
Memberyanping wang28-Jun-06 16:50 
AnswerRe: How to create a virtual printer? Pin
Hamid_RT28-Jun-06 19:03
MemberHamid_RT28-Jun-06 19:03 
GeneralRe: How to create a virtual printer? Pin
yanping wang28-Jun-06 22:50
Memberyanping wang28-Jun-06 22:50 
GeneralRe: How to create a virtual printer? Pin
yanping wang28-Jun-06 23:00
Memberyanping wang28-Jun-06 23:00 
QuestionCreateProcess problem. Pin
iLoveM28-Jun-06 16:41
MemberiLoveM28-Jun-06 16:41 
AnswerRe: CreateProcess problem. Pin
Naveen28-Jun-06 17:29
MemberNaveen28-Jun-06 17:29 
GeneralRe: CreateProcess problem. Pin
iLoveM28-Jun-06 22:16
MemberiLoveM28-Jun-06 22:16 
AnswerRe: CreateProcess problem. Pin
Hamid_RT28-Jun-06 19:00
MemberHamid_RT28-Jun-06 19:00 
GeneralRe: CreateProcess problem. Pin
iLoveM28-Jun-06 22:18
MemberiLoveM28-Jun-06 22:18 
GeneralRe: CreateProcess problem. Pin
Naveen28-Jun-06 22:43
MemberNaveen28-Jun-06 22:43 
QuestionRe: CreateProcess problem. Pin
David Crow29-Jun-06 3:27
MemberDavid Crow29-Jun-06 3:27 
QuestionRe: CreateProcess problem. Pin
David Crow29-Jun-06 3:23
MemberDavid Crow29-Jun-06 3:23 
AnswerRe: CreateProcess problem. Pin
iLoveM29-Jun-06 15:47
MemberiLoveM29-Jun-06 15:47 
QuestionHow to display 2 byte characters Pin
surendra vk28-Jun-06 14:11
Membersurendra vk28-Jun-06 14:11 
AnswerRe: How to display 2 byte characters Pin
Michael Dunn28-Jun-06 15:28
sitebuilderMichael Dunn28-Jun-06 15:28 
GeneralRe: How to display 2 byte characters Pin
surendra vk28-Jun-06 16:00
Membersurendra vk28-Jun-06 16:00 
GeneralRe: How to display 2 byte characters Pin
Joe Woodbury28-Jun-06 16:18
professionalJoe Woodbury28-Jun-06 16:18 

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.