- bool got_exception = false;
- try
- {
- infostream<<"** running client.Receive()"<<std::endl;
- peer_id = 132;
- size = client.Receive(peer_id, recvdata);
- infostream<<"** Client received: peer_id="<<peer_id
- <<", size="<<size
- <<", data="<<*recvdata
- <<std::endl;
- }
- catch(con::NoIncomingDataException &e)
- {
- infostream<<"** No incoming data for client"<<std::endl;
- got_exception = true;
- }
- UASSERT(got_exception);
- }
-#endif
-#if 0
- /*
- Send large amounts of packets (infinite test)
- Commented out because of infinity.
- */
- {
- infostream<<"Sending large amounts of packets (infinite test)"<<std::endl;
- int sendcount = 0;
- for(;;){
- int datasize = myrand_range(0,5)==0?myrand_range(100,10000):myrand_range(0,100);
- infostream<<"datasize="<<datasize<<std::endl;
- SharedBuffer<u8> data1(datasize);
- for(u16 i=0; i<datasize; i++)
- data1[i] = i/4;
-
- int sendtimes = myrand_range(1,10);
- for(int i=0; i<sendtimes; i++){
- server.Send(peer_id_client, 0, data1, true);
- sendcount++;
- }
- infostream<<"sendcount="<<sendcount<<std::endl;
-
- //int receivetimes = myrand_range(1,20);
- int receivetimes = 20;
- for(int i=0; i<receivetimes; i++){
- SharedBuffer<u8> recvdata;
- u16 peer_id = 132;
- u16 size = 0;
- bool received = false;
- try{
- size = client.Receive(peer_id, recvdata);
- received = true;
- }catch(con::NoIncomingDataException &e){
- }
- }
- }