Thelvyn
18/06/2006, 22h58
bonsoir !
jai un probleme pour effectuer une connexion :00000010:
// RakNet
#include <RakNet/RakNetworkFactory.h>
#include <RakNet/RakPeerInterface.h>
// Windows
#include <windows.h>
// Std
#include <iostream>
#include <string>
int main( int argc, char** argv )
{
RakPeerInterface* rakPeer = RakNetworkFactory::GetRakPeerInterface();
std::string command;
std::cout << "rejoindre : /join \nattendre : /wait \n";
std::cin >> command;
// juste un test on n'est pas sense taper autre chose
if( command == "/join" )
{
rakPeer->Initialize( 1, 60000,0,0 );
while( rakPeer->GetPlayerIDFromIndex(0) == UNASSIGNED_PLAYER_ID )
{
Sleep(50);
rakPeer->Connect( "127.0.0.1" , 60500 , 0,0 );// marche tres bien
}
}
else if( command == "/wait" )
{
rakPeer->Initialize( 1, 60500, 0, 0 );
rakPeer->SetMaximumIncomingConnections( 1 );
while( rakPeer->GetPlayerIDFromIndex(0) == UNASSIGNED_PLAYER_ID )
{
Sleep( 50 );
}
}
std::cout << "Connection OK" << std::endl;
Sleep( 2000 );
RakNetworkFactory::DestroyRakPeerInterface( rakPeer );
return 0;
}
ce code marche tres bien, le probleme arrive quand je remplace 127.0.0.1 par mon ip, jai fait plusieurs tests avec un ami il n'arrive pas a me rejoindre.
PS. jai peut etre fait des conneries , jai commencé raknet ce matin :00000025:
jai un probleme pour effectuer une connexion :00000010:
// RakNet
#include <RakNet/RakNetworkFactory.h>
#include <RakNet/RakPeerInterface.h>
// Windows
#include <windows.h>
// Std
#include <iostream>
#include <string>
int main( int argc, char** argv )
{
RakPeerInterface* rakPeer = RakNetworkFactory::GetRakPeerInterface();
std::string command;
std::cout << "rejoindre : /join \nattendre : /wait \n";
std::cin >> command;
// juste un test on n'est pas sense taper autre chose
if( command == "/join" )
{
rakPeer->Initialize( 1, 60000,0,0 );
while( rakPeer->GetPlayerIDFromIndex(0) == UNASSIGNED_PLAYER_ID )
{
Sleep(50);
rakPeer->Connect( "127.0.0.1" , 60500 , 0,0 );// marche tres bien
}
}
else if( command == "/wait" )
{
rakPeer->Initialize( 1, 60500, 0, 0 );
rakPeer->SetMaximumIncomingConnections( 1 );
while( rakPeer->GetPlayerIDFromIndex(0) == UNASSIGNED_PLAYER_ID )
{
Sleep( 50 );
}
}
std::cout << "Connection OK" << std::endl;
Sleep( 2000 );
RakNetworkFactory::DestroyRakPeerInterface( rakPeer );
return 0;
}
ce code marche tres bien, le probleme arrive quand je remplace 127.0.0.1 par mon ip, jai fait plusieurs tests avec un ami il n'arrive pas a me rejoindre.
PS. jai peut etre fait des conneries , jai commencé raknet ce matin :00000025: