Last change
on this file since 438 was
438,
checked in by dumenim, 18 years ago
|
Client got a new function send Chat
|
File size:
726 bytes
|
Rev | Line | |
---|
[438] | 1 | #include <iostream> |
---|
| 2 | #include <string> |
---|
| 3 | #include "PacketManager.h" |
---|
| 4 | #include "Client.h" |
---|
| 5 | |
---|
| 6 | using namespace network; |
---|
| 7 | |
---|
| 8 | int main(){ |
---|
| 9 | network::PacketGenerator pck; |
---|
| 10 | const int PORT = 55556 |
---|
| 11 | std::cout << "Enter address of the server xxx.xxx.xxx.xxx (enter for localhost)" << std::endl; |
---|
| 12 | std::string str; |
---|
| 13 | std::getline(std::cin, str); |
---|
| 14 | std::cout << "You entered: " << str << std::endl; |
---|
| 15 | if(str.compare("")==0) |
---|
| 16 | str="127.0.0.1"; |
---|
| 17 | |
---|
| 18 | Client client( str, PORT ); |
---|
| 19 | if ( client.establishConnection() ) |
---|
| 20 | cout << "connection established" << endl; |
---|
| 21 | else cout << "problems establishing connection" << endl; |
---|
| 22 | |
---|
| 23 | while (true) { |
---|
| 24 | client.update(); |
---|
| 25 | cout << "your message: "; |
---|
| 26 | getline( cin, str ); |
---|
| 27 | client.sendChat( str ); |
---|
| 28 | } |
---|
| 29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.