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.

DarkBASIC Professional Discussion / Please help me!!! Server/Client Connection Error

Author
Message
XandY
15
Years of Service
User Offline
Joined: 5th Sep 2010
Location:
Posted: 6th Sep 2010 04:50
Hey guys, XY here.

I am a recent DBPro convert (from c++) and I have been starting to program a game with a few buddies. We're having some issues with client/server connection-- referring to some random cpp packets. We have even tried running the "Cube World" server and client and have had errors connecting via tcp/ip and LAN(by hamachi). We know how to port forward, and this has been a couple days that we've been trying to sort these issues out and help would be GREATLY appreciated.

Attached are some screenshots of errors (client side)--
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 6th Sep 2010 19:21
Ok, that's not so bad.

What does your encryption key code look like?

It should read something like this on both client and server, and obviously the temp1 and temp2 values have to be the same on both.



vampire2948
16
Years of Service
User Offline
Joined: 16th Jul 2010
Location:
Posted: 6th Sep 2010 21:14 Edited at: 6th Sep 2010 23:36
Hi - I'm another programmer working on the project with XandY.

Our code currently doesn't use the mn create key command, since it creates a different key each time we ran the server, and we hadn't added in a means for the server to send this key to the client yet.

Instead, we just defined a key (created by using the mn Create Key 256 command) and kept it the same.

This code shows some lines of our server source which handles encryption. It is the same for the other parts of the code in which we encrypt a packet.




Thank you,
Michael P
20
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 7th Sep 2010 00:07
Theres your problem!! The mnCreateKey commands return a memory address to an object which stores information about the key. The memory address changes each time but the key remains the same. If you create two keys with the same parameters in two different applications, encryption and decryption will operate correctly between the two applications.

vampire2948
16
Years of Service
User Offline
Joined: 16th Jul 2010
Location:
Posted: 7th Sep 2010 00:25
I tested that, with a short program to print a generated key, then regenerate it, and print it again infinitely. It created different keys each time.

That's why I use a key without the mn create key command.

I'll try what you say, though. Thanks!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 7th Sep 2010 18:54
Yup, you have to create the key on the client and the server using the same inputs (the Temp1 and Temp2 in my example code).

So if you want a rotating key, you will have to devise a way to send the inputs for mn Create Key from the server to the client unencrypted, or encrypted by your own method, then use it on the client to create a key on that end.

Michael P
20
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 7th Sep 2010 19:42
Quote: "I tested that, with a short program to print a generated key, then regenerate it, and print it again infinitely. It created different keys each time."

What you printed was the memory address to the object that maintains the encryption key. The memory address doesn't mean anything useful; DarkNet uses it to access stored information about the key.

Login to post a reply

Server time is: 2026-07-23 09:15:14
Your offset time is: 2026-07-23 09:15:14