NetworkTransport.ReceiveFromHost

I’m having a few issues with this one. It seems to be blocking even though I have the GlobalConfig.ReactorModel set to SelectReactor. I’ve tried various GlobalConfig.ThreadAwakeTimeout values, but none seem to make any difference.

I’m using NetworkTransport.Init(myGlobalConfig); to initialise the network transport.
Does anyone have any ideas or best practices when using the LLAPI NetworkTransport?

Many thanks

No, it is definitely non-blocking call for all models. I guess there is a problem in your code.

Does anyone have any ideas or best practices when using the LLAPI NetworkTransport?
Hm, don’t know. I would say if HLAPI fit our needs - use it. Hence, HLAPI doesn’t support all possible game topology. What you will do if your game requires more than one server? or p2p communications?

Thanks for that :slight_smile:
I tried using it in the while loop as shown on the blog, but it ate up all CPU time. Is it intended to be run from a different thread, or am I missing something else?

:slight_smile: it just means that call is non-blocking. For example if you will add something like while(1); in your code you will receive the same behavior (100% cpu for one core configuration and nothing happened). Generic approach to handle this is:
Func()
{
int evntCount = 200; //maximum messages which you can handle in one frame without gameplay
//performance degradation
while( evntCount-- )
{
evnt = ReceiveFromHost();
if( evnt == Nothing )
break;
}
}

Ah right, that makes sense. So the GlobalConfig.ThreadAwakeTimeout should be the time interval in ms before ReceiveFromHost throws a Nothing?

PS Thanks for the help :slight_smile:

No:) In select model and fixrate model all network stuff is doing in special network thread. The main loop of this thread looks like:
wait for min of (something on socket received, waitingTimeout happened)
{
if(something on socket received)
HandleReceivedPackets();
if(currentTime - lastupdateTime > waitingTimeout )
udpate_Send_for_all_hosts_and_all_connected_connections();
}
waitingTimeot above it is GlobalConfig.ThreadAwakeTimeout. Other words GlobalConfig.ThreadAwakeTimeout is a minimum timeout when system will try to grab messages ready to send, combine them to packet and send out.

Was I clean?