Now I am trying to add code to my C++ program to make it communicate with the debugger program. I have a simple program like this:
if (enet_initialize()!=0)
{
Print("Failed to initialize enet.");
}
else
{
ENetAddress address;
ENetEvent enetevent;
address.host = ENET_HOST_ANY;
address.port = 7776;
InterpreterDebugHost = enet_host_create(&address,64,0,0);
if (InterpreterDebugHost==NULL)
{
Print("Failed to create host on port "+String(address.port));
}
else
{
Print("Checking for events loop...");
bool exitloop = false;
int time = Millisecs();
while (true)
{
int result = enet_host_service(InterpreterDebugHost,&enetevent,0);
if (result>0)
{
switch (enetevent.type)
{
case ENET_EVENT_TYPE_CONNECT:
Print("Connect");
exitloop=true;
break;
case ENET_EVENT_TYPE_DISCONNECT:
Print("Disconnect");
break;
case ENET_EVENT_TYPE_RECEIVE:
Print("Receive");
break;
case ENET_EVENT_TYPE_NONE:
Print("No event");
break;
}
}
else
{
if (result<0) Print("enet_host_service failed.");
}
if (Millisecs()-time>10000) exitloop = true;
if (exitloop) break;
}
Print("Done with events loop");
}
}
}
For some reason, the C++ program never detects any events, even though it is pretty much identical to my other test program not written in C++.
This topic is locked






