Events in Server scokets. Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
johnnie
Experienced Solver
Experienced Solver
Posts: 64
Joined: Mon Jan 14, 2008 8:59 am
Location: Bangalore
Contact:

Events in Server scokets.

Post by johnnie » Wed Jul 21, 2010 8:37 am

Hi all,

I am working on wxWidgets 2.8.10 on windows platform. I have a peculiar problem with the sockets.

I have a server and two clients are connected to it.

If I make the first client BLOCKING, events like INPUT/LOST of the client two are no reaching server. And also the data which is sent from server is not reaching the client two.

If I make the client two as BLOCKING, the events related to client one is not reaching server.

Please help.

Regards
Johnnie

wxWidgets version : 2.8.10
Gcc versino : 4.5
Eclipse : Galelio
OS : windows XP service pack 3.
--johnniealan --

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Wed Jul 21, 2010 12:44 pm

You may need to show some code.
But, in general, make sure to properly use one thread per client on the server. A single-threaded server in blocking mode cannot serve more than one client
"Keyboard not detected. Press F1 to continue"
-- Windows

johnnie
Experienced Solver
Experienced Solver
Posts: 64
Joined: Mon Jan 14, 2008 8:59 am
Location: Bangalore
Contact:

Post by johnnie » Wed Aug 04, 2010 11:46 am

Hi all,

After lots of trail and errors I was able to resolve this issue.

Instead of BLOCKING (wxSOCKET_BLOCK) I used wxSOCKET_NOWAIT and handled the error WOULD_BLOCK. I changed the ReadMsg to Read and handled the errors.

Code: Select all

iCount=0;
while(iCount!= length)
{            	            	                              
   pCurrentSock->Read((pucSockData + iCount) , length-iCount );
   if (pCurrentSock-> Error() == TRUE)
   {
     if(wxSOCKET_TIMEDOUT != pCurrentSock->LastError()&& wxSOCKET_NOERROR !=pCurrentSock->LastError() )
     {
     	continue ;
     }
   }
   iCount +=pCurrentSock->LastCount();
}
Thanks for your help Auria

Regards
Johnnie
--johnniealan --

Post Reply