SHARE
TWEET

Untitled

a guest Jun 13th, 2016 293 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void TestNetworkWorker::Run(EventLoop         * pEventLoop,
  2.                             CoroBase          * pCoroMain,
  3.                             CoroBase          * pCoroWorker,
  4.                             ClientCoroSocket  * pClientSocket)
  5. {
  6.     const UINT_32 iBufSize = 65536;
  7.     CHAR_P sBuffer = (CHAR_P)malloc(iBufSize);
  8.  
  9.     CoroSocketPoll oPoll(pCoroMain, pCoroWorker);
  10.     Poll::PollRec oPollRec;
  11.     oPollRec.socket = pClientSocket;
  12.  
  13.     for(;;)
  14.     {
  15.         UINT_64 iReadBytes = 0;
  16.         UINT_64 iSentBytes = 0;
  17.  
  18.         oPollRec.events = Poll::READ;
  19.         oPoll.Poll(&oPollRec, 1, 1000);
  20.         pClientSocket -> Read(sBuffer, iBufSize, iReadBytes);
  21.  
  22.         oPollRec.events = Poll::WRITE;
  23.         oPoll.Poll(&oPollRec, 1, 1000);
  24.    
  25.         pClientSocket -> Write(sBuffer, iReadBytes, iSentBytes);
  26.     }
  27.     free(sBuffer);
  28. }
  29.  
  30. void TestNetworkWorker::Run(ClientSocket  * pClientSocket)
  31. {
  32.     const UINT_32 iBufSize = 65536;
  33.     CHAR_P sBuffer = (CHAR_P)malloc(iBufSize);
  34.  
  35.     SocketPoll oPoll;
  36.     Poll::PollRec oPollRec;
  37.     oPollRec.socket = pClientSocket;
  38.  
  39.     for(;;)
  40.     {
  41.         UINT_64 iReadBytes = 0;
  42.         UINT_64 iSentBytes = 0;
  43.  
  44.         oPollRec.events = Poll::READ;
  45.         oPoll.Poll(&oPollRec, 1, 1000);
  46.         pClientSocket -> Read(sBuffer, iBufSize, iReadBytes);
  47.  
  48.         oPollRec.events = Poll::WRITE;
  49.         oPoll.Poll(&oPollRec, 1, 1000);
  50.    
  51.         pClientSocket -> Write(sBuffer, iReadBytes, iSentBytes);
  52.     }
  53.     free(sBuffer);
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top