Archived

This forum has been archived. Please start a new discussion on GitHub.

Quick question

I know this may sound stupid but how would I go about creating a instance of the communicator in C++?

I am not using the Ice Application.

In my LoginState.h I have Ice::CommunicatorPtr communicator;

Then in my enter method I put communicator = new Ice::Communicator(); which results in errors:

Error 1 error C2259: 'Ice::Communicator' : cannot instantiate abstract class c:\Users\Empire Games\Desktop\Prototype Client\Source\Prototype Client\Prototype Client\Source\LoginState.cpp 19 Prototype Client

Comments

  • Ok I think I got it now.

    I put:
    communicator = Ice::initialize();

    everything compiles just fine and even though calling any of the server methods results in the client crashing same thing happens on my test console client which uses the Ice Application so I dont think it has anything to do with the communicator not getting initialized correctly.
  • xdm
    xdm La Coruña, Spain
    Hi,
    communicator = Ice::initialize();

    That is correct, i suggest you to take a look to demo/Ice/minimal/ the demo shows how to create clients and servers that doesn't use Ice::Application.
    everything compiles just fine and even though calling any of the server methods results in the client crashing same thing happens on my test console client which uses the Ice Application so I dont think it has anything to do with the communicator not getting initialized correctly.

    We need more details to know what is going on, the best will be to provide a self contained example that demonstrate the problem. We also need to know what Ice , c++ compiler, and Os versions do you use.

    Best Regards,
    José
  • dwayne
    dwayne St. John's, Newfoundland
    everything compiles just fine and even though calling any of the server methods results in the client crashing same thing happens on my test console client which uses the Ice Application so I dont think it has anything to do with the communicator not getting initialized correctly.

    Debug/Release library mix-up is is a very common cause of crashes on Windows. See this FAQ for more information.
  • Theres prob. a error on the server that is resulting in the client crashing. Our Server programmer turned the server on and then went AFK so for now I just need to wait for him to get back to see if theres a error on the server or if its a error on my end.
  • xdm
    xdm La Coruña, Spain
    Theres prob. a error on the server that is resulting in the client crashing. Our Server programmer turned the server on and then went AFK so for now I just need to wait for him to get back to see if theres a error on the server or if its a error on my end.

    The client crash indicates a problem with your client code, if there was simply a problem with server you will get a exception of some kind, it doesn't matter what the server does, a client crash means there is a problem in client code.

    This doesn't mean that there isn't an error in the server, but it should not made the client crash, if the client code was correct.

    Best Regards,
    José
  • Ok we have narrowed the problem down to a problem with the error handling when entering wrong username and password.

    LoginState.h
    com::empiregames::generated::network::ServerException _Error;

    LoginState.cpp
    enter method:
    _Error = com::empiregames::generated::network::ServerException();

    onRequestLogin method:
    _Server->login(nickname,password);
    if(_Error.errorCode == 100001)
    {
    //Username->setText("Incorrect Information!");
    }
    else
    {
    StateManager::getSingleton().advance("WorldState");
    }
  • Everything now is working great. I put it inside a try/catch statement which I should have thought of sooner but oh well it is all working as expected now.