aboutsummaryrefslogtreecommitdiff
path: root/src/tests/multiserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/multiserver.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/tests/multiserver.cpp b/src/tests/multiserver.cpp
index 22ce94b..85971b5 100644
--- a/src/tests/multiserver.cpp
+++ b/src/tests/multiserver.cpp
@@ -19,8 +19,12 @@ public:
19 19
20 virtual void onNewData( Bu::Client *pClient ) 20 virtual void onNewData( Bu::Client *pClient )
21 { 21 {
22 pClient->write( pClient->getInput() ); 22 char buf[1024];
23 pClient->seek( pClient->getInputSize() ); 23 while( pClient->hasInput() )
24 {
25 int iAmnt = pClient->read( buf, 1024 );
26 pClient->write( buf, iAmnt );
27 }
24 } 28 }
25}; 29};
26 30
@@ -34,20 +38,23 @@ public:
34 38
35 virtual void onNewData( Bu::Client *pClient ) 39 virtual void onNewData( Bu::Client *pClient )
36 { 40 {
37 Bu::FString sTmp = pClient->getInput(); 41 while( pClient->hasInput() )
38 for( int j = 0; j < sTmp.getSize(); j++ )
39 { 42 {
40 if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) 43 char sTmp[1024];
41 { 44 int iAmnt = pClient->read( sTmp, 1024 );
42 sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; 45 for( int j = 0; j < iAmnt; j++ )
43 }
44 else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' )
45 { 46 {
46 sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; 47 if( sTmp[j] >= 'a' && sTmp[j] <= 'z' )
48 {
49 sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a';
50 }
51 else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' )
52 {
53 sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A';
54 }
47 } 55 }
56 pClient->write( sTmp, iAmnt );
48 } 57 }
49 pClient->write( sTmp );
50 pClient->seek( pClient->getInputSize() );
51 } 58 }
52}; 59};
53 60