Revision 70, 0.5 KB
(checked in by trnewman, 16 years ago)
|
Fixed send and recv problems whrn trying to send multiple consecutive msgs. PEEEK
|
Line | |
---|
1 | #include "ClientSocket.h" |
---|
2 | #include "SocketException.h" |
---|
3 | #include <iostream> |
---|
4 | #include <string> |
---|
5 | |
---|
6 | int main ( int argc, int argv[] ) |
---|
7 | { |
---|
8 | try |
---|
9 | { |
---|
10 | |
---|
11 | ClientSocket client_socket ( "localhost", 30003 ); |
---|
12 | |
---|
13 | std::string reply; |
---|
14 | |
---|
15 | while(1) { |
---|
16 | try |
---|
17 | { |
---|
18 | client_socket >> reply; |
---|
19 | } |
---|
20 | catch ( SocketException& ) {} |
---|
21 | |
---|
22 | std::cout << "We received this response from the server:\n\"" << reply << "\"\n";; |
---|
23 | |
---|
24 | } |
---|
25 | } |
---|
26 | catch ( SocketException& e ) |
---|
27 | { |
---|
28 | std::cout << "Exception was caught:" << e.description() << "\n"; |
---|
29 | } |
---|
30 | |
---|
31 | return 0; |
---|
32 | } |
---|