Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / DarkNet conversion to 2.0 - mn Poll Connect Errors

Author
Message
Omen
12
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 4th Feb 2011 05:14
Before DarkNet 2.0, I used to be able to call mn Poll Connect at regular intervals as part of my main game loop.

Now every time it hits mn Poll Connect, I always get the error "An error occurred in mn Poll Connect whilst polling on the status of a connection attempt, connection process has not begun at line 410 of file "NetInstanceClient.cpp". Error code 0. Version "Release v2.0". Would you like to exit?"

The problem is that I KNOW the connection process has started AND finished because the client and server have already begun sending data back and forth -- the logs on the server show that it has received the client connection and already send and received data


Is mn Poll Connect no longer supported, or does it work differently now?

This used to work just fine (the profile additions were added to support 2.0's new profile requirement, but everything else is the same):

Main Module


NetClient Module


Michael P
13
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 4th Feb 2011 12:06
mnPollConnect may work slightly differently, since everything was completely rewritten from scratch.

I can replicate your problem if I call mnPollConnect after the connection process has ended:


In the above code if you uncomment line 36 the error occurs. Apart from the commented out line, that is how mnPollConnect is intended for use.

After mnPollConnect returns a value other than 2 it shuts down the instance so that it can be reused. The problem is probably that you are calling mnPollConnect on the instance after this has happened.

A solution to your problem may be to use code like this:


Omen
12
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 5th Feb 2011 06:14
Thanks Mike, unfortunately I don't think that's it...

As my code is written, as soon as mnPollConnect returns a 1, the module adds SYSTEM_MODE_NET_TCP to the systemMode, which prevents mnPollConnect from ever being called again (and it's only called in 1 place in the whole program). So on the next game loop, it can't call mnPollConnect - it switches over immediately to calling mnClientConnected to make sure the connection is still good.

I did try your suggestion though, but the problem with using mnGetConnecting as a "prefilter" is that it prevents us from ever interrogating the mnPollConnect result. When the connect happens, mnPollConnect and mnGetConnecting simultaneously get their attributes updated -- so one blocks us from seeing the other :/

From my logs, what's happening is that it's hitting this code:



...but it's never hitting this code:



... which means that the connection is getting completed BETWEEN the mnConnect and the very first mnPollConnect.

It's looking like what is happening is that the mnConnect is so fast now that it can connect and complete all of its updates to all its internal attributes before I ever get a chance to even run mnPollConnect once.

I'm a big fan of efficiency and all, but this looks a LOT like a race condition. I should ALWAYS be able to call mnPollConnect at least once :/

Michael P
13
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 5th Feb 2011 12:29 Edited at: 5th Feb 2011 12:34
You've got the block option enabled so mnConnect doesn't return until the connection process has completed. mnPollConnect isn't supposed to be used unless this is set to false. If the block option is enabled, mnConnect returns the result of the connection process.

Race conditions don't look like this, not in DarkNet anyway. You would see errors with no specific details, random crashes and application freezes. Luckily though DarkNet is written properly, so you won't see that .

Also, mnPollConnect can always be called at least once if the block option is disabled, even if the connection does complete instantly.

Omen
12
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 5th Feb 2011 18:41 Edited at: 5th Feb 2011 18:42
Aha!!! Thanks Mike, that did the trick -- I should have caught that one.

Also VERY happy the hear that mnPollConnect can always be used at least once -- I was worried that very fast computers might be able to complete their connect before I could get to the polling. But it sounds like you've taken care of that. Nicely done.



Login to post a reply

Server time is: 2019-10-15 09:56:59
Your offset time is: 2019-10-15 09:56:59