Cafu Engine Startup Error

Get help with installing and running the Cafu Engine here. This forum is also for general questions and discussion of all aspects regarding the Cafu Engine.
rtdds
Posts:19
Joined:2010-11-11, 19:44
Re: Cafu Engine Startup Error

Post by rtdds » 2010-11-14, 18:37

Here are the Stack-Logs of our Remote Control Work.
Attachments
CallStack1.txt
(1.42KiB)Downloaded 467 times
CallStack2.txt
(3KiB)Downloaded 460 times
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-14, 20:48

Thanks for your help and for uploading the files! :wohow:

For the records, I've filed this as ticket #53 at http://trac.cafu.de/ticket/53
CallStack1.txt above has been produced without catching exceptions first chance,
CallStack2.txt had for this purpose C++ EH exceptions enabled in the Event Filter dialog of WinDbg.

I'll provide a fix asap. :up:
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-18, 18:54

Ok, ticket #53 is fixed now, see r179 for details.
If you use Subversion, just update and recompile.
Otherwise, please download the three modified files from the r179 link above, and copy them over the files in your source code tree.

Note that you should now see a proper, specific error message, not the crash as before.
That is, you should see (do you?) something like:

Code: Select all

class ServerT::InitErrorT
Unable to obtain UDP socket on port 30000.
However, the root of the problem is (probably) still unresolved - the OS doesn't let Cafu have a UDP socket on that port.
I would suspect that most likely some (personal) firewall is active that is configured to block any UDP (as opposed to TCP) connection attempts...
Best regards,
Carsten
rtdds
Posts:19
Joined:2010-11-11, 19:44

Re: Cafu Engine Startup Error

Post by rtdds » 2010-11-18, 19:49

ok, now I see the error.

For testing, I have deactivate my AntiVir and my Firewall(Windows Firewall), and I have sets the udp and tcp port 30000 on my router "Fritzbox".
No effects. The error is still there.
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-19, 01:42

Hi,
thanks for the feed-back. No need to modify the FritzBox, the problem is on the local system (but it's good to turn off the personal firewalls, at least for testing).

I've created a version of Libs/Network/Network.cpp with additional logging:
Network.zip
Libs/Network/Network.cpp file with additional logging.
(5.58KiB)Downloaded 437 times
Please extract this file, overwrite the existing Libs/Network/Network.cpp with it, recompile, and try again (with -log console.txt as before), then post the result of console.txt here (the lines beginning with [Dev] are enough).

It should mention one of the error codes listed at http://msdn.microsoft.com/en-us/library ... 85%29.aspx :up:
Best regards,
Carsten
rtdds
Posts:19
Joined:2010-11-11, 19:44

Re: Cafu Engine Startup Error

Post by rtdds » 2010-11-19, 08:10

This are both Errors I got:

Code: Select all

[Dev] WinSockT::GetUDPSocket(131): WSAGetLastError() == 0
[Dev] WinSockT::GetUDPSocket(146): WSAGetLastError() == 10048
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-19, 12:14

Well, according to Microsoft documentation:
WSAEADDRINUSE 10048 - Address already in use.

Typically, only one usage of each socket address (protocol/IP address/port) is permitted. This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing. For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO_REUSEADDR). Client applications usually need not call bind at all—connect chooses an unused port automatically. When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed. This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.
Have you tried using another port, e.g.

Code: Select all

Cafu -svPort 12345
?
What does console command

Code: Select all

netstat -a
output?
Use

Code: Select all

netstat -ab
to see the related program as well (may require admin rights).
Best regards,
Carsten
rtdds
Posts:19
Joined:2010-11-11, 19:44

Re: Cafu Engine Startup Error

Post by rtdds » 2010-11-19, 15:18

So, now the problem is solved! :!: 8)
I searched with "netstat -ab" in the Comand-Line the programm which the UDP-Socket 30000 reserves.
My result: 1&1 Softphone
So I stoped the programm and now there is no error if I start up the Cafu Engine.

So you should fix the problem by using a function that search for a free port to use.

Thank you!
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-19, 17:11

rtdds wrote:So, now the problem is solved! :!: 8)
I searched with "netstat -ab" in the Comand-Line the programm which the UDP-Socket 30000 reserves.
My result: 1&1 Softphone
So I stoped the programm and now there is no error if I start up the Cafu Engine.
Ahhh! That's good to know, thanks!! :cheesy:
So you should fix the problem by using a function that search for a free port to use.
Sorry, but no, that is not the proper way:
  • A server must connect to a "fixed" port that is known to the clients in advance - otherwise how are they supposed to connect? (Unless the server port is explicitly communicated to the clients beside the servers IP address.)
  • For clients, the matter is different. The Cafu client currently asks for a fixed port as well, but it's also possible to have the OS pick a suitable one. You can achieve this already by using the command-line paramter

    Code: Select all

    -clPort 0
    (Join a map and use netstat -a to check...)
    This can also be set permanently by entering

    Code: Select all

    dlg_clPortNr = 0;
    into file config.lua (near the end of the file).
It would be possible to make dlg_clPortNr = 0 the application default instead of 30000, but this doesn't help with the server port (and thus wouldn't have made a difference for the problem in this thread), and I'd have to check and verify the details under Linux first.
Best regards,
Carsten
User avatar
BRabbit
Posts:28
Joined:2010-08-16, 19:26
Location:Moscow, Russia

Re: Cafu Engine Startup Error

Post by BRabbit » 2010-11-21, 19:47

LOL. The 'Unhandled exception' error on the loading screen is simply produced by opening more than one instance of Ca3De.
Just close them (maybe you'll need to use the Task Manager). :wink:

It happened to me before. :cheesy:
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-22, 12:28

BRabbit wrote:The 'Unhandled exception' error on the loading screen is simply produced by opening more than one instance of Ca3De.
Thanks for mentioning this!
I've opened a new ticket for now (http://trac.cafu.de/ticket/54) and will look into it later.
Best regards,
Carsten
User avatar
BRabbit
Posts:28
Joined:2010-08-16, 19:26
Location:Moscow, Russia

Re: Cafu Engine Startup Error

Post by BRabbit » 2010-11-22, 17:31

Anyway, i don't think is a problem of Cafu itself, in fact, I have previously developed a LAN chat application, and it wasn't possible to emulate a LAN in a single computer by running two instances (it also used a client-server architecture, the program itself was a server and a client, when there was not server, it created it) of the program (I think because the port is already used). So everytime I wanted to debug the program, I had to open it in 2+ computers... :roll:
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu Engine Startup Error

Post by Carsten » 2010-11-22, 23:45

BRabbit wrote:Anyway, i don't think is a problem of Cafu itself
Cafu can do that. I've done it before (some of the screenshots were made this way, running Cafu multiple times on the same machine helps getting a sufficient number of players into the game, no matter how late the time of day ;) ).

The current problems are really only related to port collisions, somewhat of a leftover of the changes (that were a huge benefit otherwise) we did when porting Cafu to 64-bit Windows.
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests