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.

Program Announcements / MikeNet - Multiplayer Plugin

Author
Message
Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 15th Mar 2011 14:29
@ Michael P:

Hi,
it will be great it you could do something like that, because more players could connect to games, and you can be able to deliver your games to a bigger audience. For us is a necessity, but we want to manage all our code by darknet.

If you want details, want to try with someone we can communicate with each other by e-mail or skype. We have both codes so we can try out (Darkbasic and Darknet), and can test anytime you want.

Regards
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 15th Mar 2011 14:39 Edited at: 15th Mar 2011 14:40
@ Alfa X
Yeah I will let you know how I get on over Easter. I'll put it to the top of my to do list .

@ hookkshot
Possibly is just due to the way your router is setup. Will run some tests over Easter...

hookkshot
17
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 15th Mar 2011 15:23
ok thanks im testing the nat punch through soon. will i have to punch through on the same port to make it work

2.0Gh AM2 Processor, 9800GT, 2Gb Ram
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 15th Mar 2011 17:39
Are you sure?

NAT traversal is not the same thing as NAT punch-through. How are you doing it?

If you are just using the Universal Plug and Play module, this is just NAT traversal. And you forward an external port (any one) to the internal port that the server is running on.

hookkshot
17
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 15th Mar 2011 22:54
Im connecting to a server then that server points players to your ip if you choose to host

2.0Gh AM2 Processor, 9800GT, 2Gb Ram
Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 21st Mar 2011 22:01
Hi, Michael.

I think the wrong installer version is in the web page for download. It doesn't has upnp. (can be that i have problems with my pc too)
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 21st Mar 2011 22:36
What language are you using? The UPnP commands are in a different namespace to the networking commands (mnNAT).

hookkshot
17
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 22nd Mar 2011 03:44
Michael would you be able to explain how exactly to do a nat-punch through.

So far ive got my server online running all the time. Clients connect to the online server, if they host they stay connected until the game is actually started. Clients connect to hosted games by selecting from a list of hosted games on the online server. the hosted games come up in the list but the clients cant connect to them

2.0Gh AM2 Processor, 9800GT, 2Gb Ram
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 23rd Mar 2011 12:27
No because I haven't researched it enough to walk you through it. But you can google search it.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 27th Mar 2011 21:37
Michael:

I was in the middle of porting my current game project to Darknet 2 and it went horribly wrong. Every command was throwing errors, and the error according to mn Get Error Full was:

An error occurred in N/A whilst performing an unknown operation at line 0 of file "N/A". Error code 0. Version "Release v2.0"

It wasn't until 15 minutes later that I realized the problem. mn Get Error Flag() is supposed to return true or false depending on if an error was thrown. I was expecting it to return a "1" or a "0". It doesn't. It returns 14872320 for false, and 14872321 for true. Therefore, my if mn Get Error Flag() then ... commands were always executing, notifying me of errors that didn't actually exist.

Everything is working perfectly now, but I thought I would share my troubles in case anyone else runs into the same problem.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 28th Mar 2011 02:10
I think this happened in an older version of v1 and I fixed it. Looks like I've reintroduced it to v2 and now I've forgotten what I did!

If I'm right then this is DBP specific and I think if you do something like:


then you get the correct result of 1 or 0, its only if you don't directly assign it to a boolean that you get these weird values.

Should be easy to fix, will do this over Easter. Also its looking like I'll have very little time over Easter so don't expect a big update, will probably only be bug fixes ..

JohnFT
13
Years of Service
User Offline
Joined: 6th Apr 2011
Location:
Posted: 7th Apr 2011 07:14
Has anyone got MikeNet2 to work with Vista 64-bit and a router? I get an error message saying there is a problem with mnNAT::StartNAT... I tried everything (enabled upnp in wired router, enabled Network Discovery in Vista (private Network), tried Virtual Server (Port Forwarding) on Dynex DX-E402 router... HELP! I never had a problem with the previous version of MikeNet (1.7).

Thanks
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 8th Apr 2011 01:59
Can you confirm that the previous version of MikeNet works fine now? Its unlikely since the code is very similar.

JohnFT
13
Years of Service
User Offline
Joined: 6th Apr 2011
Location:
Posted: 8th Apr 2011 22:07
I thought about that also. When I tried the previous version (after compiling it with the old MikeNet.dll), it also gives me the same error. I have no idea what changed.

I have made progress with the Port Forwarding though. I had a setting enabled in the Networks and Sharing area (Sharing tab), that was messing up the Port Forwarding with the Dynex DX-E402 router I'm using. Now, Port Forwarding works fine. So I guess I'll be using it for now, until I fine time to try and figure out what went wrong and it now causing the StartNAT... while retrieving the port mappings error.

It has been said that upnp is unreliable, maybe I'm better off just using Port Forwarding in the router?
dzsana
15
Years of Service
User Offline
Joined: 10th Nov 2009
Location:
Posted: 12th Apr 2011 11:01
I have a problem with getting my ip.

const char * LocalHost = mn:NS_B(""); is not working for me on my (Win7) PC.

It returns with "0.0.0.0". But it works fine on my friend's PCs (winXP).

I downloaded the demos (binary) and they works on both PC.

What did i do wrong?

chill
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 17th Apr 2011 08:31
Michael:

Been working on some projects that I am coming a long way with and I have hit a snag. Here is the general rundown of what happens.

Client connects to server (on another PC entirely BTW). Client sends Username to server. Server sends 4 double ints to the client encrypted with the users password. Client decrypts the packet with his password, gets the 4 double ints (which is the new encrypt key). Uses the new key to encrypt his username and send it back to the server for verification.

So far everything works great. The client and server agree upon an encryption key without the user's password ever getting sent over the line. My problem is that if I close out the Client while it is connected to the server, the EXE lingers in memory. If I shut down the server app, the server app does the same thing. I have to CTRL+ALT+DELETE both apps to shut them down.

Anyway, to summarize, when the EXE is closed and a DarkNet connection exists, DarkNet keeps the program active in memory. I thought that the easy way to fix it is to use Matrix to capture the WM_CLOSE windows message and shut down any darknet stuff prior to the program exiting. So I did, and it didn't fix anything.

Also, loading up both programs, but closing them before they connect causes them to shut down properly, so it is only when they successfully connect...

Any thoughts?

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 17th Apr 2011 16:36 Edited at: 29th Apr 2011 20:44
@ JohnFT
UPnP simply allows your application to setup port forwarding automatically. It is fine to do it manually, and unless games are peer to peer, most commercial server applications instruct users to manually setup port forwarding.

If you want to get UPnP working try:
- restarting router.
- restarting PC.
- ensure UPnP is enabled on both PC and router.

It is unreliable because it is poorly implemented on most routers and/or windows.

@ dzsana
Thats a bug in windows vista upwards where for some reason they made DNS queries return 0.0.0.0 instead of the default 127.0.0.1. You can fix this by modifying the 'hosts' file (google this and you should find a guide to help). It is fine just to assume 127.0.0.1 is local host without querying it.

@ GIDustin
DBP doesn't seem to clean up DarkNet's memory very nicely, to fix this delete any packets which have been encrypted or decrypted during their lifetime.

The reason for the problem is that when you encrypt or decrypt a packet it sets up some threads so that the process can be distributed to multiple cores at the same time. When a packet uses these threads it becomes associated with them. The last packet to be destroyed is responsible for closing the threads. If the threads are never closed then DarkNet hangs waiting for the threads to close.

I may include some code to do this automatically in mnFinish.

@ all
I have been working on a fairly small update and should be on track to release this within the next 2 weeks. It will include:
- Broadcasting bug fix.
- UDP performance improvements.
- Security enhancements, by restricting memory usage of clients.

Attachments

Login to view attachments
Jambo B
15
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 29th Apr 2011 15:51
@Michael P and hookkshot

I have the same problem with broadcasting... PCs on the LAN can see their own broadcasts, but not those coming from other computers.

Thanks for working on it Michael.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 29th Apr 2011 20:35 Edited at: 29th Apr 2011 20:42
I hoped to get the next version sent off today but it needs more testing first. Should be ready soon though!

There's some really nice performance tweaks under the hood which I'll explain.

UDP Performance
Every time a UDP packet is received MikeNet searches through a list of connected clients' UDP addresses and uses this to identify which client the UDP packet belongs to.

The current version of DarkNet simply iterates through the list until it finds the client with the required address. This is pretty criminal performance wise, because on average we have to search through half the clients, so if we have 1024 clients, that's 512 comparisons every time a UDP packet is received.

In the next version, DarkNet uses an efficient sorting algorithm (std::sort from C++) to sort the clients by UDP address, and then searches through this sorted list using a binary search.

Sorting only happens when absolutely necessary which means at worst the list is sorted every time a client joins or leaves the server.

The searching side of the algorithm happens every time a UDP packet is received, and this takes log2(maximum number of clients) in the worst and average case. This means that now receiving a UDP packet where the server can hold 1024 players, takes only 10 comparisons; this is a significant performance improvement.

Memory Management
Memory allocation and deallocation can be expensive, and so one way of increasing performance is to minimize this.

I've optimized the receiving system only, but similar steps can be applied to the sending system too but I will do this in a later version.

In the current version the steps taken when receiving a packet under normal circumstances are as follows:


The memory allocation and deallocation that occurs is wasteful.

In the next version I use a clever system of 'memory recycling' which means that under normal circumstances a server/client can be running with no memory reallocation whatsoever!


The bold arrows show the most common path, and the other arrows (where normal allocation/deallocation occurs) are used where the requested memory is too large, or the recycle bin is empty.

In addition the next version features:
- mnGetErrorFlag bug fix for DBP users where it returns weird values.
- Broadcasting bug fix.
- Security enhancements.

Attachments

Login to view attachments
Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 29th Apr 2011 22:26
Sounds good, lets just say I will be testing and using Mikenet/Darknet as the backbone for a project test I am releasing very soon, I will hopefully be able to highlight the strengths of it using it


Making dreams possible, one line at a time...
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 30th Apr 2011 07:36 Edited at: 30th Apr 2011 07:45
@Michael:

Last time I checked DarkNet still didn't play nice with empty strings. Is that something that can be easily fixed? The problem occurs when the receiving end attempts to get the string using the prefixing method as opposed to fix length.

I haven't tested in awhile, but checking every string I send and replacing with a dummy character if it is empty is quite inefficient.

Also, the speed enhancements you have mentioned look very promising!


Edit: Also, how prone to tampering is your encryption? If I have 512 bytes of encrypted data, and I change one byte somewhere in the middle of the packet, will 511/512 bytes still decrypt fine or approximately what percentage of the packet will decrypt wrong? I am wondering because I want to add random bytes of data throughout an encrypted packet that I can check to make sure that the right key was used and that nothing was tampered with, and I am just curious as to how far apart they should be spaced.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 30th Apr 2011 13:39
@ Oneka
Good stuff, if you have any problems with DarkNet along the way feel free to email me.

@ GIDustin
Not sure if I fixed the empty string issue, but if I haven't I will for the next release.

Encryption and decryption works on 16 byte chunks of the packet. So e.g. if you change the 4th byte the first 16 bytes will not decrypt properly, but all other bytes will decrypt fine.

Jambo B
15
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 30th Apr 2011 17:31
Thanks for your cracking work, Michael
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 1st May 2011 04:41
@Michael:

I am trying to send a memblock over DarkNet and it isn't working as I am expecting it to. Also, there doesn't appear to be an online help-file for it.

The Keywords INI states this:


Is "Memblock Ptr" just the memblock variable, or do we need to "get memblock ptr()" and pass that? Also, what do the return values of MN GET MEMBLOCK mean? Is it possible to get an example of how this is used?

It seems that the error messages associated with Memblocks reference strings, either that or my code just got really messed up...

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 1st May 2011 13:52
@ GIDustin
I have fixed GetString with empty strings for the next release.

Memblock commands call GetStringC and AddStringC from the documentation.

Sample code:


Its important that the destination memblock has enough space to store the retrieved memblock. You can use mnGetStringSize to check the size of the memblock before retrieving it.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 1st May 2011 20:15 Edited at: 1st May 2011 20:18
@Michael:

I changed my memblock code to resemble yours and I am still having issues. The client sends the packet, the server never receives it, and the client is almost immediately disconnected from the server. If I comment out the few lines about memblocks, the packet sends just fine. I have error modes 1 and 2 enabled on both client and server, but I do not get any error popups and "mn Get Error Flag()" remains false. The memblock isn't deleted until after the packet is sent using the blocking version of the command. Any clue what might be causing this?

I thought it might be a problem with my program, which is huge, so I broke it down to this, and I get the same problem. It is rather sloppy, but it gets the point across. The client will attempt to convert an image to a memblock and send it to the server. The image is attached.



Attachments

Login to view attachments
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 1st May 2011 21:20
I suspect the problem is that the TCP buffer size is too small. By default it is 1024 bytes (1kb) and your image is 2.8kb. The default behaviour whenever a client does anything wrong, is to silently disconnect it. I've been meaning to add in functionality to determine why a client was disconnected.

Take a look at mnSetProfileBufferSizes. The buffer sizes reflect the maximum size an incoming packet can be.

Also if clients can trust the server (which is normally the case) then you can make the TCP buffer automatically resize using mnSetProfileAutoResizeTCP.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 1st May 2011 21:54
@Michael:

Changing the buffer sizes solved the problem. Thanks!

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 2nd May 2011 00:52 Edited at: 2nd May 2011 01:06
Version 2.0.1
Hi all,

Today v2.0.1 is completed and should be available to download via your TGC account on Tuesday or Wednesday.

You can view the updated documentation here.

The following bugs have been fixed:
- Retrieving empty strings from packets in DBP will no longer cause an error.
- Broadcasting now works with the following code:


Note that a single broadcast instance cannot send and receive at the same time, so you do need to make separate broadcast instances for sending and receiving.


Security
DarkNet is now 100% secure in the sense that there is no way to crash a server or client so long as memory limits are low enough to prevent the application from running out of memory. Ofcourse DarkNet cannot account for any code you've written yourself, but DarkNet itself is secure.

By default there are no memory limits, but you can use mnSetProfileSendMemoryLimit and mnSetProfileRecvMemoryLimit to change these. All memory limits apply to an individual client (i.e. each clients memory usage is logged individually) except UDP sending, which applies to the entire instance.

The memory usage of a client can be retrieved using mnGetRecvMemorySizeUDP, mnGetRecvMemorySizeTCP and mnGetSendMemorySizeTCP. Before a client is allowed to exceed its memory limit it is silently disconnected.

Memory Recycling
This is explained nicely in a previous post. I will now detail the specifics on how you use this system and what its impact is.

Memory recycling allows you to trade space efficiency for processing efficiency. There are two key options which decide how significant the trade is: 'number of recycle packets' and 'memory size of packets'. These are configured by mnSetProfileMemoryRecycleTCP and mnSetProfileMemoryRecycleUDP.

The number of recycle packets is the number of packets that can be in the 'recycle bin' at any one time. At startup the recycle bin is populated with this number of packets. The recycle bin may decrease in size as packets are taken out and used, but will never exceed this size. Packets in the recycle bin are always of size 'memory size of packets'. Therefore the maximum size that the recycle bin can be is: number of packets * memory size of packets. This is the approximate loss in space as a result of using the recycle bin.

The gains from using memory recycling depend on how many needless deallocations are prevented. Memory recycling will prevent needless deallocations so long as:
- The number of packets in the queue waiting to be received via mnRecvTCP or mnRecvUDP is less than the number of packets which can be stored in the memory recycle bin. If this is not the case, for every extra packet that goes over the limit an allocation and deallocation will occur.

- The memory size of packets received and packets sent asynchronously do not exceed the size of packets in the memory recycle bin. For every packet that does an allocation and deallocation will occur. This limit is useful if e.g. you send a large map file to clients when they join, there's not much point recycling a huge packet because the space trade is not worth the small increase in performance from this one off event.

Lastly, the memory recycle is taken into account in memory limits so everything is still secure.

Its important to note that the server will continue running as normal no matter what you set the parameters to, only efficiency will change.

This may be a bit confusing at first so feel free to ask questions.

[edit]
Due to a bug in VS the C++ VS2008 debug version of DarkNet wouldn't compile, but you can still use the release version and either version of VS 2010.

Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 2nd May 2011 01:00
How secure is mikenet when connected by another program (not using mikenet)


Making dreams possible, one line at a time...
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 2nd May 2011 01:01
100%, it can't be crashed by any application.

GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 2nd May 2011 01:24
@Michael:

I want to pick your brain here a moment.

I am trying to find the best way to handle something. I didn't use to use encryption and so I used the non-blocking send commands and everything ran nice and fast. Now I have a seperate encrypt key for each client, and I want to send the same packet to each person in the server. Currently I have to do something like this:



The problem is that I have to use the blocking version of each command and wait for the packet to be encrypted, and then sent, and then deleted. I could make some kind of system that does this in a function or something, but a simpler command that I can call and forget would be nice. A non-blocking "encrypt, then send, then delete" type of command.



Just curious if you have any suggestions before I make some type of Packet Queue system of my own.

Also, with your new memory enchancements, I am curious as to how packets are handled in this process. I know you cannot send a packet until it is done being encrypted, but when you call "mn send TCP", does it copy the packet to a buffer or access it directly? Could I use the non-blocking send command and immediately delete the extra packet or would I run the risk of erasing memory that is currently being accessed?

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 2nd May 2011 02:07
The mnSend commands directly use the memory of the packet if blocking.

If non blocking the mnSend commands copy the packet into another memory location so that you don't have to wait for the send operation to finish before reusing your packet.

So in your code above, you don't have to wait for the packet to be sent before deleting it. Also it would be faster if you had a persistent packet dedicated to encryption, and copied packet data into this rather than creating a fresh encryption packet each time.

I can see the potential applications for an encrypt and send command; I'll look into implementing this but it is unlikely to happen any time soon.

Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 5th May 2011 04:20
I am having an issue with including Mikenet in my project, when I have it included and run my program I will now get a pop up saying


"This application has failed to start because MSVCP90.dll was not found. Re-installing the application may fix this problem."

I can compile the regular client and server demo code that is provided and run it with no issue, but when included into my app I get this message, I guess it might be a configuration issue on my part


Making dreams possible, one line at a time...
Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 6th May 2011 06:10
Well I solved my problem, it was a manifest issue, I had to turn it back on, and just suffer the annoying .bat files it creates!


Making dreams possible, one line at a time...
Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 28th May 2011 08:00
Hey Michael P I have some issues with MikeNet, would like to contact you to resolve this!


Making dreams possible, one line at a time...
Kretaner
14
Years of Service
User Offline
Joined: 19th Oct 2010
Location: Crete, Greece
Posted: 26th Jun 2011 18:03
Update from MikeNet 2 to 2.0.1:

Hello Mike,
I have just replaced my MikeNet-2 files with the latest update from May 3,2011. Unfortunatly I can't compile my program anymore.
>>I'm still using VC 2008 and I'm in the debug mode<<

1) First I have a warning for every class file from the compiler:
c:\program files (x86)\the game creators\darknet2\cpp\include\mikenet\memoryusagelogrestricted.h(24) : warning C4250: 'MemoryUsageLogRestricted': Erbt(inherits) 'MemoryUsageLog::MemoryUsageLog::GetMemorySize' via Dominanz
1> c:\program files (x86)\the game creators\darknet2\cpp\include\mikenet\memoryusagelog.h(27): Siehe Deklaration von (see declaration) 'MemoryUsageLog::GetMemorySize'

2) At the end the Linker gives me a lot of error messeages:
>MikeNetDebug.lib(NetSend.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__invalid_parameter_noinfo".
1>MikeNetDebug.lib(ThreadSingleMessage.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__invalid_parameter_noinfo".
1>MikeNetDebug.lib(NetModeUdpCatchAll.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__invalid_parameter_noinfo"
......

If I'm using the previous DarkNet 2.0.0 files I dont' have any problem and I have no idea what the problem is now with 2.0.1.

Please give me a hint or little bit help !
Thanks Norman
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 26th Jun 2011 22:25
I couldn't compile the VS 2008 debug version which must be a bug in VS since all the other versions compiled fine. So to fix this change the code generation option to multithreaded (/MT) instead of multithreaded debug (/MTd). You lose a big of debugging power, but I doubt this will be a major problem.

Kretaner
14
Years of Service
User Offline
Joined: 19th Oct 2010
Location: Crete, Greece
Posted: 27th Jun 2011 12:03
Hey Michael !

I'm compiling the debug version all the time only with /MT.
Buit I was looking for your latest files:
Now the debug file for VS2008 is called 'mikenetdebug' without capital letters, before it was 'MikeNetDebug', the same as now for thew VS2010 Libs. Maybe this is the probelm fpr the Linker errors (the warnings of the compiler could be ignored, isn't it ) ?

(PS: Unfortuntaly, upgrading to VS2010 and using your new VS2010 libs is not possible. After updatig of the files from VS2010 I always the error C2061 for '__RPC__out_xcount_part' for every compiling class file.)
GIDustin
16
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 3rd Jul 2011 23:23 Edited at: 3rd Jul 2011 23:24
Michael,

I have been recently having problems with encryption. I am using our encryption functions to encrypt files I don't want the user messing with, for instance, an achievements file.

What happens is that I load a file byte by byte into a packet, then decrypt the packet and extract the contents using your "get" commands. I am getting an error when I try to encrypt the packet and then write it byte by byte back into the file.

The specific error is:



Using a debug log, it happens on the "mn encrypt" line. The packet being encrypted is 2278 in size, being encrypted with key 97495072. When it works, which is becoming more rare, the packet ends up being 2288 in size after the encryption. I have the "EM_MESSAGE_BOX" error mode turned on and it doesn't pop up with anything.

Any ideas?

Attachments

Login to view attachments
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 5th Jul 2011 23:16
Hey MP!
I suspect a dumb mistake, but what can "An unknown error occurred whilst trying to connect." (mn Connect result -1) entitle? As when I try to connect using my code (which should be identical to the example code, which DOES work) this error appears and I can't spot on why... I'll probably have to provide code, but do you have any idea what this COULD mean?

swis
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 6th Jul 2011 01:14 Edited at: 6th Jul 2011 01:15
@ swissolo
Basically means that something went wrong i.e. it could be anything. Post some code and maybe I'll spot what you're doing wrong.

@ GIDustin
This looks like a bug I've already fixed, I just haven't got round to releasing the update officially. Email me and I'll send you the update, please specify what language you want it for.

@ Kretaner
Did you try doing what I suggested in my last post?

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 6th Jul 2011 01:43 Edited at: 6th Jul 2011 02:26
No surprise there. I'll conjure up the code up till the connection... and if it matters at all the code is being run from within functions in conjunction with sparky's and EVOLVED's advanced lighting. I don't see why it would, but the two actually conflict... and advanced lighting broke AA anyways...

This is the server code toggled by h(for now) this is only a fraction of it up till it waits for the client unsuccesfully. The rest is bound to be bugged XD but currently doesn't matter


Here's the client joining code toggled by j (this is all run from 1 file, but I run multible copies BTW)

those missing values are set as globals (in a different place) and defined as


The code is a bit sloppy in general, sorry

and the last rediculous thing I could think of is that my code was using multisync, and performed fine and well, but I've been converting it, so I may being missing some key component of DarkNet or just miss using something I'm not aware of...

well... yep. I just tossed a bunch of information together... you can have more if you want XD I really wonder what's wrong though... Well thanks for the help!

Edit: oh also, this only occurs when the server IS available and hosted

swis
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 9th Jul 2011 08:28
Hey Michael P, could you please take a look at this for me?

It would be much appreciated.
Thank you.

http://forum.thegamecreators.com/?m=forum_view&t=186734&b=22
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 10th Jul 2011 15:30 Edited at: 10th Jul 2011 15:38
@ swissolo
The connection timeout is specified in milliseconds, not seconds (this changed moving from v1 to v2) so what is happening is the connection instantly times out. I think 0 is not returned because it doesn't even get to the initial connecting stage, it just fails straight away.

[edit]
Actually sorry I see its 4000 now, so ignore that. Not sure what the problem is then, maybe something wrong with the server setup outside of the application e.g. firewall etc. Does it fail straight away or is there a pause?

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 10th Jul 2011 19:49 Edited at: 10th Jul 2011 19:53
It's instant, and as I said if the server isn't available it acts normally informing me that there is nothing to connect to, but if it can connect though, it just flops.

Edit: Oh, and my local firewall is completely OFF so... Shouldn't be the problem

swis
No, it's not pokemon.
Joined: Tues Dec 16th 2008
RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 18th Jul 2011 00:09 Edited at: 18th Jul 2011 00:54
Hey Mike

when MikeNet was still kind of a beta-release, which was several years ago, I had helped you fix some bugs... or maybe I was just bugging you for those fixes.
anyways, until recently I still had MikeNet v1.1.1 installed, and was using that for some simple Client/Server testing in my current project. Now I bought DarkNet v2.01 and adjusted my code to the new Profile system. Now the login code, which establishes an encrypted connection if the correct password is provided, is working like it did before... But if I try to send (unencrypted) UDP packets after this connection process is done, the server crashes with the following messages:
Quote: "An error occurred in mn::GetFloat whilst getting data from a packet. The end of the packet was reached before all data could be extracted from the packet at line 248 of file "[some path here]\mikenet\Packet.h". Error code 0. Version "Release v2.0". Would you like to exit?"

Quote: "An error occurred in an internal function (~ThreadSingle) whilst executing. The cause of the error is unclear at line 64 of file "ThreadSingle.cpp". Error code -1. Version "Release v2.0". Would you like to exit?"

Is the Client supposed to add the Operation AND his ID now? Or am I missing something else...

And something completly different, which happened right after I installed DarkNet (before I could even use the DLL, but until right now I thought I had fixed that. Looks like I didn't...)

I guess it has to do with the way Plug-ins are verified/activated: When I try to compile with the new DLL installed, the Compiler actually only "understands" the Commands found in MikeNet v1.1.1. The new profile commands result in an "Could not understand Command [...] at line [...]". If i compile some code which only creates packets & calls MnStart, the compiler allows me to compile it, but at execution the first command ("Mn Create Packet") "was not found in DLL MikeNet.dll" (I don't have the exact message right now).
So after that, I tried to find a different version of the DLL, and actually managed to extract a MikeNet.dll (774kb) from someone else's compiled Exe. This dll seems to be v2.0, as my DLLs size is 845kb. When I put the 2.0-dll into my plugins-licensed folder, my project seems to compile fine, it even does compile and work if I reinsert the 2.0.1 dll! But after a few times (might also be related to restarting the IDE?) I have to repeat this dll-replacement-procedure.
And right now I added the command "Mn Assign Packet" to my code, which is not recognized by the compiler with any of both DLLs again, so I can't compile my Project at all with that.

So, incase anyone actually understands what's happening (this post was kinda (re)written while those things happened... I think I might have to reread all of this ) then please tell me what the heck is wrong here.

Some information:
Windows 7 x64 (don't have SP1 yet.)
DBP v7.6 (just updated to 7.7 RC7, but still doesn't understand MnAssignPacket)
Using new default IDE aka Synergy

Edit:
Except for the "Mn Assign Packet" the 2.0.1 version does seem to work now. I replaced "Mn Assign Packet" with a combination of "Mn Clear Packet" and "Mn Add Packet", which should do the same thing? My UDP connection is still not working. The first client's packets are don't crash the server anymore, but if a second client joins it's connection seems to be reset immediatly ("Mn Client Connected([intance],0)" returns 0).

Edit2:
I just realized I was still using "Mn Add Int" for the Operation ID instead of "Mn Add SizeT"
Now the packets seem to be formulated correctly, but when joining with a second client, the FIRST client gets kicked out and keeps getting disconnected when it tries to reconnect. Somehow I think my code is doing something horribly wrong... but this did work in mikeNet v1!
So... could someone maybe post an example on using TCP and UDP (perClient,perOperation) in DarkNet v2?

Edit3:
Nevermind... I had messed something up while changing the Operation IDs... now it all seems to work

Conclusion of this post: DarkNet v2.0.1 didn't seem to work in DBP 7.6, but does work with 7.7 RC7. And "Mn Assign Packet" is not being recognized by the Compiler.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 18th Jul 2011 23:44
@ swissolo
Is the server running on your machine or a hosted server? If its a hosted server then I think its likely to be some problem on their side. Otherwise I don't know, you could try the new version (email me and I'll send it to you).

@ RedFlames
Quote: "And "Mn Assign Packet" is not being recognized by the Compiler."

Yes I seem to remember fixing that ready for 2.0.2. Anyways it works for me now, so if you really want it email me and I'll forward you the update.

@ All
There is a new version coming which fixes some critical bugs, I will release it hopefully this week or next week.

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 19th Jul 2011 01:07
It's on my machine... I'll try to get through to you later...

swis
No, it's not pokemon.
Joined: Tues Dec 16th 2008
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 19th Jul 2011 01:21
Try binding to a different local IP address perhaps, what IPs are available on your system?

Login to post a reply

Server time is: 2024-11-21 19:28:00
Your offset time is: 2024-11-21 19:28:00