2
« on: December 22, 2012, 01:39:20 pm »
allright allright , i understood you cant give me teh code cuz it may be dangerous to use from someone like me but , just tell me if this is right , and if it is , give me a list or a command list for vcmp windows server RPCs
// XServer.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include "RakPeerInterface.h"
#include "PacketLogger.h"
#include <stdlib.h>
#include "WindowsIncludes.h"
#include "Gets.h"
#include "RPC4Plugin.h"
#include "RakSleep.h"
using namespace RakNet;
RPC4 rpc4;
void CFunc1( RakNet::BitStream *bitStream, RakNet::BitStream *returnData, Packet *packet )
{
//printf("CFunc3 ");
RakNet::RakString data;
//int offset=bitStream->GetReadOffset();
bool read = bitStream->ReadCompressed(data);
RakAssert(read);
printf("%s\n", data.C_String());
returnData->WriteCompressed("CFunc7");
};
int main()
{
RakNet::RakPeerInterface *sv = RakNet::RakPeerInterface::GetInstance();
//RakNet::PublicKey *pk;
//if(sv->Connect("127.0.0.1",5192,"ios",sizeof("ios"),0) == RakNet::CONNECTION_ATTEMPT_STARTED) printf("Connection started!\n");
//sv->Connect("127.0.0.1",5192,"ios",sizeof("ios"),0);
//rpc4.RegisterBlockingFunction("CFunc1", CFunc1);
RakNet::Packet *pak;
sv->AttachPlugin(&rpc4);
RakNet::SocketDescriptor sod;
sv->Startup(10,&sod,1);
sv->Connect("127.0.0.1",1234,"ios",sizeof("ios"));
char msg[2048];
RakNet::BitStream comp1 , comp2;
while(1)
{
Gets(msg,sizeof(msg));
if (strcmp(msg,"connect") == 0)
{
comp1.Write(6);
comp1.Write(sizeof("ion"));
comp1.Write("ion",sizeof("ion"));
rpc4.Call("ClientJoin",&comp1,HIGH_PRIORITY,RELIABLE_ORDERED,0,sv->GetSystemAddressFromIndex(0),false);
for(pak=sv->Receive();pak;sv->DeallocatePacket(pak),pak=sv->Receive())
{
printf("%s\n",pak->data);
break;
}
}
}
//rpc4.CallBlocking("Blocking",&comp1,HIGH_PRIORITY,RELIABLE_ORDERED,0,sv->GetSystemAddressFromIndex(0),&comp2);
/*
while (1)
{
Gets(msg,sizeof(msg));
if (strcmp(msg,"signal") == 0)
{
rpc4.CallBlocking("Blocking",&comp1,HIGH_PRIORITY,RELIABLE_ORDERED,0,sv->GetSystemAddressFromIndex(0),&comp2);
for(pak=sv->Receive();pak;sv->DeallocatePacket(pak),pak=sv->Receive());
{
RakNet::RakString rcs;
bool rdt = comp2.ReadCompressed(rcs);
printf("%s\n",rcs.C_String());
break;
}
}
*/
for(pak=sv->Receive();pak;sv->DeallocatePacket(pak),pak=sv->Receive())
{
printf("%s\n",pak->data);
}
//}
//for(pak=sv->Receive();pak;sv->DeallocatePacket(pak),sv->Receive())
// ;
//RakNet::RakString rcs1;
//bool rdt = comp1.ReadCompressed(rcs1);
//printf("it is : %s\n",rcs1.C_String());
// break;
//}
getchar();
RakNet::RakPeerInterface::DestroyInstance(sv);
return 0;
}
notice : i tested sv->connect , returns true so it connects , but when i type msg , i dont recive something ... oh and the .call retrurns null ... thx