Changeset 777 for code/branches/FICN/src/network/dummyclient2.cc
- Timestamp:
- Dec 31, 2007, 7:40:23 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/network/dummyclient2.cc
r660 r777 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * 4 * 5 * License notice: 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Author: 22 * Oliver Scheuss, (C) 2007 23 * Co-authors: 24 * ... 25 * 26 */ 27 27 28 28 // … … 34 34 #include <string> 35 35 #include <enet/enet.h> 36 37 #include "util/Sleep.h" 36 38 #include "PacketManager.h" 37 39 #include "ClientConnection.h" 38 39 #ifdef WIN3240 #include <windows.h>41 #define usleep(x) Sleep((x)/1000)42 #else43 #include <unistd.h>44 #endif45 40 46 41 using namespace network; … … 71 66 72 67 for(int i=0; i<10; i++){ 73 74 75 68 // weihnachtsmann bringt packete 69 // extend the packet and append the string foo to it 70 // send packet to peer on channel id 0 76 71 client.addPacket(pck.chatMessage("test")); 77 72 // keep the timeout very small for low delay 78 73 if(client.sendPackets(&event)){ 79 74 std::cout << "successfully sent: " << event.type << std::endl; … … 81 76 std::cout << "failed sending" << std::endl; 82 77 } 83 // usleep(1000000);78 // usleep(1000000); 84 79 } 85 80 usleep(1000000); 86 81 // now disconnect 87 82 if(client.closeConnection()) 88 83 std::cout << "Connection successfully closed" << std::endl; … … 90 85 std::cout << "Connection closing failed" << std::endl; 91 86 92 87 // 3 seconds timeout 93 88 return 0; 94 89 }
Note: See TracChangeset
for help on using the changeset viewer.