Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 7, 2007, 8:38:47 PM (16 years ago)
Author:
scheusso
Message:

adapted PacketBuffer to work with ENetPacket *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/PacketBufferTestExt.cc

    r187 r188  
     1#include <string>
     2#include <iostream>
     3#include <enet/enet.h>
     4#include <boost/thread/thread.hpp>
    15#include "network/PacketBuffer.h"
    26#include "network/PacketBuffer.cc"
    3 #include <boost/thread/thread.hpp>
    4 #include <iostream>
    5 #include <string>
    67
    78using namespace network;
     
    910
    1011void write(PacketBuffer *test){
    11   PacketEnvelope p;
     12  ENetPacket *packet;
    1213  if(test->isEmpty())
    1314    std::cout << "empty buffer" << std::endl;
    1415  for(int i=0; i<10; i++){
    15     p.data=i*i;
    16     std::cout << i << ": pushing " << p.data << std::endl;
    17     test->push(p);
     16    std::string temp = "packet ";
     17    packet = enet_packet_create("packet", strlen("packet ")+1,
     18ENET_PACKET_FLAG_RELIABLE);
     19    std::cout << i << ": pushing " << packet->data << std::endl;
     20    test->push(packet);
    1821    if(i==5)
    1922      usleep(200000);
     
    2932    // only pop if the queue isn't empty
    3033    while(!test->isEmpty()){
    31       int i=test->pop().data;
    32       std::cout << "We popped the value " << i << std::endl;
     34      std::cout << "We popped the value " << test->pop()->data << std::endl;
    3335    }
    3436  }
Note: See TracChangeset for help on using the changeset viewer.