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
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 24th Jan 2009 17:55
Quote: "You can get around this problem by using mnSetDecryptUDP to tell MikeNet to decrypt UDP packets with the specified key as they arrive. "


Ah, got it.

ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 27th Jan 2009 06:08 Edited at: 27th Jan 2009 06:34
Would it be possible for you to compile a ".a" library using the MingW compiler? I'm having issues compiling a ".lib" and having trouble converting the ".lib" to a ".a" file.

I've tried putting "MikeNet.lib" file into "C:\MingW\lib" and the "MikeNet.h" in "C:\MingW\include". Upon compiling I get undefined reference errors when calling any MikeNet functions.

Your signature has been erased by a mod because it's larger than 600x120
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 27th Jan 2009 18:41
MikeNet uses 'WS2_32.lib' so you will need to add that as an additional dependency. That should solve the problem but if it doesn't then copy/paste the errors into a code snippet and I'll see if I can help.
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 27th Jan 2009 23:24 Edited at: 28th Jan 2009 10:47
I've included "ws2_32.a" also and same errors. I've compiled this exact code using the compiler from VC++ Express 2008 and linking the ws2_32.lib and MikeNet.lib. But it refuses to compile using the MingW compiler. The MingW site says it can compile .lib's but I think that functionality is limited as this is not working.




There would be more errors But I'm only testing it with that one command for now to make sure it compiles before trying to code the entire thing.


[EDIT] I'd also suggest adding

at the top of your MikeNet.h file and

at the bottom. That way it'll avoid redefinition errors if you include it in multiple files.

Your signature has been erased by a mod because it's larger than 600x120
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 28th Jan 2009 17:50
I'm surprised that MingW can't deal with mnCreatePacket because it is a relatively simple function. Next week I will have a go at compiling with MingW.

Thanks for your suggestion, I will do that
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 29th Jan 2009 17:14
Is there server suppose to use 50% of my CPU? Or is there a way to make it not use so much?

Your signature has been erased by a mod because it's larger than 600x120
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 29th Jan 2009 17:17
You probably have your application looping permanently without any sort of sleep or wait command inside the loop. It is looping several thousand times a second, much more than needed. You could put Sleep(1) inside the loop from the windows header (windows.h).
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 29th Jan 2009 21:43 Edited at: 29th Jan 2009 23:42
Won't that stop the server every loop for a second. Thus causing lag?

[EDIT] Tested with Sleep(1), the players skipped around ( LAG ). But it did solve the 50% CPU issue.

Your signature has been erased by a mod because it's larger than 600x120
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 29th Jan 2009 21:44
A millisecond, so the effect probably won't be noticeable
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 29th Jan 2009 23:49
Ok, thanks. The Sleep command I first used paused it for a second. The sleep command associated with the thread's I'm using paused it for a millisecond, which fixed the 50% CPU issue and no noticeable lag.

Your signature has been erased by a mod because it's larger than 600x120
Alfa x
17
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 30th Jan 2009 05:29 Edited at: 30th Jan 2009 05:34
First of all thanks. IThis plug in is a life saver and it's great.

Second of all sorry for this looooooooong message i have many things to say.

About what I said earlier:

Quote: "Quote: "have not attempted this before, but off the top of my head I would achieve this by giving each client three or more instances. 1. mnConnect to main server, 2. mnStartServer to receive data from other clients, 3+. mnConnects to other clients. Upon connection to the main server, the server sends the client's information to all other clients so that they can connect to the new client."

I will try and tell you the results. Since I'm new at this, I will show everything I will do mainly because i'm prone to make mistakes."



Quote: "Quote: "I will try and tell you the results. Since I'm new at this, I will show everything I will do mainly because i'm prone to make mistakes."

Good luck "



To do this I have implemented two instances of mikenet per client.

The flow is the following:

1) I first start the main server, so I can have the connection data for the clients. (the equal in starcraft is the battle .net server)

2) After this the first client connects with its first instance to the server, so we have the client connected. Right after that i start as server service in the first client so another client could connect to the server.

3) I connect with the second client to the server, and right after that the connections details of the first client are passed to the second client, so the second client connects with first.

And it works fantastic! .

Two things that i have to solve are the following:

Is there a way to use the same port in the first client in the two instances (client and server). This is necessary so the less numberof ports are opened. I have read this so i'm not sure if it's possible to mike net, because i think you don't have it implemented yet:


Quote: "Quote: "It's not, it's just that by default you can't bind multiple sockets to the same protocol/ip/port if they haven't be bound using the SO_REUSEADDR option. Use this, and you can bind multiple TCP sockets to the same port, but the destination IP or port must be different (a TCP socket is unique by its local ip/local port/remote ip/remote port)."

I did not know this ; thanks for the information.
"



I also want the person that plays the game, to not configure port forwarding in a manual way because in any game one person plays in the web, you don't have to do it. It's normal that you play without worring about those things.

I have come up with this:

Quote: "Hey i've had an idea. Don't know if it's possible though. Could you put UPnP or something similar into mikenet so that it can automatically forward ports from your router? I'm sure all those gamers out there would really love to see a game that you don't need to go into your router settings for."


Quote: "@ dale2507
Normally port forwarding is only necessary when hosting a server. However, I think what you are asking for is possible and so I will have a deeper look into it, although I probably won't have time to implement it for the next version."


Quote: "@ AlexI
Yes, that is my main focus for the next version "



ho yeah, . I was wondering if was possible to do such a thing.


I have some questions regarding your error handling system since i have to use an error handling system for a free plug-in i will release to the community this weekend.

HOw do you know the line number of the triggered error?

you point me to postQuitMessage(0). And i'm getting the same mistake you solved in this version, how did you do it?, did you use the DBPROcomands or exit() function in c++?. What I don't want is it to continue to execute untils it reachs the end.

Quote: "Error System
The error system in all previous versions was a little unstable. Crashes through miss-using MikeNet were not uncommon and consequently debugging was difficult, especially in DBP. In this version the error system has been rewritten so that it is much more difficult to crash MikeNet (near impossible).

In previous versions if an error occurred midway through a function the function would continue to execute until it reached the end. This meant that multiple error message boxes could be displayed, or the original error could cause a crash further down the line. In this version if an error occurs midway through a function the function exits.

In the event of an error that would normally cause a crash an error message will be displayed and no crash will occur.

The error message that is displayed now tells you what command caused the error. You can use mnGetErrorCommand to determine this when error message boxes are disabled:"




Some help files aren't triggering from DB IDE when you press F1, for example mn Set Local.




Quote: "Thread commands
You can now change the priority and affinity of MikeNet worker threads with mnToggleAffinity, mnSetAffinity, mnSetPriority, mnGetAffinity, mnGetPriority."



ho yeah!!!




Quote: "It works like a charm, and none (or very little) of the NPC data is being dropped using Per Client Per Operation mode. Not only that but ping times have dropped from an average of 300-400 to less than 60, and I haven't even experimented with multiple threads yet. "


Excuse me please if I don't know, but how do you measure the ping times?, what does ping times that means, can you explain me?
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 30th Jan 2009 09:03 Edited at: 30th Jan 2009 09:16
Quote: "Is there a way to use the same port in the first client in the two instances (client and server). This is necessary so the less numberof ports are opened. I have read this so i'm not sure if it's possible to mike net, because i think you don't have it implemented yet:"

So you want to know if mnConnect and mnStartServer can be used on the same local IP and port? At the moment this is not possible but I may be able to make it possible; I will investigate for the next version.

Quote: " I also want the person that plays the game, to not configure port forwarding in a manual way because in any game one person plays in the web, you don't have to do it. It's normal that you play without worring about those things."

uPnP should do the trick and this should be coming in the next version (if I can work out how to use it). However, there are some drawbacks:
1. It only works on windows XP and greater.
2. It only works on uPnP compatible routers.
3. It is very poorly documented, which means it will take me some time to implement.

Quote: "HOw do you know the line number of the triggered error?"

There is a macro in C++ called __LINE__ which replaces itself with the line number it is at.

Quote: "you point me to postQuitMessage(0). And i'm getting the same mistake you solved in this version, how did you do it?, did you use the DBPROcomands or exit() function in c++?."

MikeNet uses exit() if you press 'Yes' to the error message box.

Quote: "What I don't want is it to continue to execute untils it reachs the end."

MikeNet uses exceptions, so whenever an error occurs an exception is thrown which jumps to the relevant catch code.

Here is an explanation of exception handling:
http://www.cplusplus.com/doc/tutorial/exceptions.html

Here is an example MikeNet function where STD_CATCH is a definition containing catch code. If an error occurs anywhere within the try block, it will jump straight to STD_CATCH which deals with the error and can display a message box:


[edit]
Forgot:
Quote: "Excuse me please if I don't know, but how do you measure the ping times?, what does ping times that means, can you explain me?"

One way of doing this is to have the server send out a ping request at intervals e.g. every 5 seconds. When clients receive the ping request they send the ping request straight back to the server. The server then calculates the time difference between the initial ping request and the received ping back. This is the ping/latency which is the length of time (usually in milliseconds) that it takes to complete a round trip (to and from a client).

Quote: "Some help files aren't triggering from DB IDE when you press F1, for example mn Set Local."

It works for me
Alfa x
17
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 30th Jan 2009 19:20
Quote: "So you want to know if mnConnect and mnStartServer can be used on the same local IP and port? At the moment this is not possible but I may be able to make it possible; I will investigate for the next version."


I think the communication with the main server can be done only byy FTP and with other clients by both, so you don't have to have two opened ports.


Quote: "uPnP should do the trick and this should be coming in the next version (if I can work out how to use it). However, there are some drawbacks:
1. It only works on windows XP and greater.
2. It only works on uPnP compatible routers.
3. It is very poorly documented, which means it will take me some time to implement."


Thats hard to hear. There isn't another way to configure the port forwarding automatically for the user?.

Quote: "Quote: "Some help files aren't triggering from DB IDE when you press F1, for example mn Set Local."
It works for me "


Then it should be Code Surge that's the IDE i'm using.


Quote: "One way of doing this is to have the server send out a ping request at intervals e.g. every 5 seconds. When clients receive the ping request they send the ping request straight back to the server. The server then calculates the time difference between the initial ping request and the received ping back. This is the ping/latency which is the length of time (usually in milliseconds) that it takes to complete a round trip (to and from a client)."


I understand now the concept. Do you have an example (or link) of doing it?

Thank you for your support.

Cheers.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 30th Jan 2009 20:00
Quote: "Thats hard to hear. There isn't another way to configure the port forwarding automatically for the user?."

Not that I know of, but if anyone does then please let me know!

Quote: "Then it should be Code Surge that's the IDE i'm using."

Codesurge doesn't always trigger help files properly, seems to be a bug in Codesurge.

Quote: "Do you have an example (or link) of doing it?"

This example is in DBP

Server


Client
R4z0r1991
15
Years of Service
User Offline
Joined: 30th Jan 2009
Location:
Posted: 31st Jan 2009 00:15
Have one question, how do you set up the server so the clients can join it through an internet ip (like "81.256.171.176")??

Except for that, everything is working just great! It was really easy to use and the included help files is really good. Great work!

Just one more thing. I can't get the Cube or File program to work through hamachi, any thought on that?

/R4z0r1991
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 31st Jan 2009 00:32
Quote: "Have one question, how do you set up the server so the clients can join it through an internet ip (like "81.256.171.176")??"

If you have a router you will need to setup port forwarding, so you should forward to your local IP/ports. You may also need to configure your firewall. There will be some good guides on port forwarding on the internet.

Quote: "Just one more thing. I can't get the Cube or File program to work through hamachi, any thought on that?"

You will need to set the local IP to your local hamachi IP using mnSetLocal. One of the IP's returned by mnGetLocalIP should be your hamachi IP which (for me at least) looks a little different as it starts with unusual numbers e.g. mine is 5.4.116.74.
R4z0r1991
15
Years of Service
User Offline
Joined: 30th Jan 2009
Location:
Posted: 31st Jan 2009 10:22
Quote: "If you have a router you will need to setup port forwarding, so you should forward to your local IP/ports. You may also need to configure your firewall. There will be some good guides on port forwarding on the internet."


So when creating a server, I will only need to do mnStart and then mnStartServer for clients to join me through internet??

Quote: "You will need to set the local IP to your local hamachi IP using mnSetLocal. One of the IP's returned by mnGetLocalIP should be your hamachi IP which (for me at least) looks a little different as it starts with unusual numbers e.g. mine is 5.4.116.74."


I know, but the problem is that I can't host my server when using the hamachi ip. It says that "An error occurred whilst trying to connect"...

/R4z0r1991
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 31st Jan 2009 10:38 Edited at: 31st Jan 2009 10:38
Quote: "So when creating a server, I will only need to do mnStart and then mnStartServer for clients to join me through internet??"

Yes, you don't need to do anything differently for clients to connect through the internet.

Quote: "I know, but the problem is that I can't host my server when using the hamachi ip. It says that "An error occurred whilst trying to connect"..."

I am able to get it working when selecting the hamachi IP. Perhaps your hamachi is not working?

The below example is adapted ping code (from a previous post) so that you can select what IP you want to use.

Server


Client
R4z0r1991
15
Years of Service
User Offline
Joined: 30th Jan 2009
Location:
Posted: 31st Jan 2009 16:57
Everything works great now, after a day of port forwarding.

Looking forward the future uppdates...

/R4z0r1991
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 2nd Feb 2009 11:33
Not trying to rush you or anything, it's jut 5:30AM and I'm bored, lol. Have you tried compiling in MingW yet?

Your signature has been erased by a mod because it's larger than 600x120
Alfa x
17
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 2nd Feb 2009 14:01 Edited at: 2nd Feb 2009 14:36
Hi Mike I have one question and a defect report.

I have bee using MikeNet and developed a solution for a RTS game i'm making named Ultimate Apocalypse. I couldn't achieve a client in another house to connect to my house (That was a server). I tried also with cube world without results. Although i can connect in my house in the same computer through the public IP. I tried the same with the cube example of multisync with another house and it works.

I'm using per client per operation mode and enabled port forwarding thought port 3999.

I know I'm doing something wrong but i don't know what it is.

I have uploaded two images in a zip folder for you to see.

------------------------------

The error I found i that when you send something as a string in an UDP packet, it's failing.

For example the following code:



Attachments

Login to view attachments
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 2nd Feb 2009 19:16 Edited at: 2nd Feb 2009 20:25
@ ZKAT8IT
Sorry for taking so long. I tried for quite a while to compile an application in MinGW using the C++ version of MikeNet but kept getting the same errors you had. I agree with you, perhaps support for .lib is not complete.

I then tried to compile MikeNet's code using MinGW so that I could create a compatible library. Unfortunately I got a large number of errors that I could not fix. Sorry I could not help you with this issue .

@ Alfa X
Quote: "I have bee using MikeNet and developed a solution for a RTS game i'm making named Ultimate Apocalypse. I couldn't achieve a client in another house to connect to my house (That was a server). I tried also with cube world without results. Although i can connect in my house in the same computer through the public IP. I tried the same with the cube example of multisync with another house and it works.

I'm using per client per operation mode and enabled port forwarding thought port 3999.

I know I'm doing something wrong but i don't know what it is.

I have uploaded two images in a zip folder for you to see."

It is probably an issue with port forwarding. You need to make sure that both UDP and TCP ports are forwarded; have you done this?

Quote: "The error I found i that when you send something as a string in an UDP packet, it's failing.

For example the following code:"

I ran some tests based on the error that you had and have determined the problem. You must make sure that the string is initialized (it has been set to equal something) before using mnAddString. The below code demonstrates a fix to the problem:


Also, I have found a minor bug. mnConnect never returns 0, it always returns -1 even when the connection has timed out. This will be fixed for the next version.
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 3rd Feb 2009 00:39 Edited at: 3rd Feb 2009 00:45
Quote: "I then tried to compile MikeNet's code using MinGW so that I could create a compatible library. Unfortunately I got a large number of errors that I could not fix. Sorry I could not help you with this issue . "

That's ok. Thanks for trying. I'll just use the MSVC++ compiler for this project. Also, I was wondering if your plugin automatically puts the signals in some sort of Queue system to be processed by the receive commands so that they're accepted in the order sent in case of network issues causing packet overflows.

Your signature has been erased by a mod because it's larger than 600x120
Alfa x
17
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 3rd Feb 2009 01:21 Edited at: 3rd Feb 2009 03:52
Quote: "It is probably an issue with port forwarding. You need to make sure that both UDP and TCP ports are forwarded; have you done this?
"


Yes, i have port forwarded both UDP and TCP. It's strange, I'm going to try and separate both ports for TCP and UDP and try again.

Quote: "I ran some tests based on the error that you had and have determined the problem. You must make sure that the string is initialized (it has been set to equal something) before using mnAddString."


Thank you very much.


[EDIT] I have found the problem, i tested with another with another house, and it works, the first house has a DSL connection [/EDIT]
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd Feb 2009 08:21 Edited at: 3rd Feb 2009 08:23
Quote: "Also, I was wondering if your plugin automatically puts the signals in some sort of Queue system to be processed by the receive commands so that they're accepted in the order sent in case of network issues causing packet overflows."

Yes, TCP packets are always accepted in the order that they are sent and in UDP only the latest packet is received unless using catch all UDP mode in which case out of order packets can be received. All this is also true when using mnSetFunction.
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 5th Feb 2009 09:48
hmm there is something very strange going on.

When I play my game (which is online) it runs fine. Then I leave and I cant reconnect. I cant even do a remote desktop connection. Everyone else on the team can still play the game. It takes about 30 minutes for it to start reconnecting again.

A few others on the team got the same problem. I dont know if this is to do with mikenet or our ISPs or my programming so i just thought that i should ask.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 5th Feb 2009 13:53
Sounds like a firewall if its blocking connections to any port

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 5th Feb 2009 16:52
Do other applications on your computer have trouble communicating across the internet during this period where you are unable to connect? If so then it is likely to be an issue with your connection.

Whilst being unable to reconnect, can other people connect to the server? If they can then it is unlikely to be a problem with MikeNet. If they cannot then it could be that mnClientJoined is not being called frequently. Clients will be unable to connect to the server until mnClientJoined accepts their request.

It could be that the maximum number of clients has been reached. When this happens further connection attempts will fail until a client leaves.
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 5th Feb 2009 18:32 Edited at: 5th Feb 2009 18:32
This is all i know:

Its only connections with the server that dont work (Connecting with game and remote desktop connection).
If i restart the server it will work fine.
Other people sometimes get the problem, but the problem doesnt happen at the same time.
When you leave the game, you cant connect to the server for 30 minutes.
The problem is caused by the program, because other online multiplayer games dont get the same problem.


It could either be a problem with the program or a problem with the server.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 5th Feb 2009 18:37
Every loop do you call mnClientJoined and mnClientLeft?

kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 5th Feb 2009 19:35
yes, It will still connect other people while someone cant connect.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 5th Feb 2009 19:40
Quote: "yes, It will still connect other people while someone cant connect."

That suggests that there is a problem on the client's end and not the server's.

Are you using mnFinish on the previously connected instance and then reconnecting or are you exiting the client and then running it again?
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 5th Feb 2009 21:11
im using mnfinnish -1, then closing, then reopening and trying to connect again.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 5th Feb 2009 21:16 Edited at: 5th Feb 2009 21:19
In that case it is very unlikely that it is an issue with MikeNet. It is likely that the cause of the problem lies with the client's connection.

[edit]
I will have a look at the connection system to see if there is anything wrong; I'll do this before releasing the next version.
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 5th Feb 2009 23:06
ive just spent half an hour trying to make it crash while running it on my local network. I was using 3 clients and making each of them disconnect/reconnect. I couldnt make it crash. It must be the server.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 5th Feb 2009 23:16
I had a brief look at the connection code and it seems to be okay. I also ran a test where I had around 20 clients continuously connecting/disconnecting and everything worked fine.

It could be simply that the timeout values are too low. If the connection takes too long to complete then the client may be unable to connect; this would be especially likely for clients with slow connections. You could try increasing the timeout value on the client side with mnConnect, and increasing the timeout value on the server side with mnSetServerTimeout.
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 6th Feb 2009 18:17 Edited at: 6th Feb 2009 18:19
It works perfectly if I remove all my UDP code. The TCP code is fine, but if I have UDP in there, it crashes.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 6th Feb 2009 18:44 Edited at: 6th Feb 2009 18:47
I have some questions which will help me to diagnose the problem, if you can answer these then I can check over relevant code and see if there is anything wrong:

1. Without UDP are you using mnDisableUDP?
2. What UDP mode are you using?
3. When you say crash, what exactly do you mean i.e does the server/client exit unexpectedly with no error message?

[edit]
Another question:
4. Are you using mnSetFunction?
Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 6th Feb 2009 18:52
Make sure your not sending empty UDP Packets, that was a problem I had, so what I did was before each send code I had a check to make sure outgoing UDP or TCP packets were not empty, I have a system that sends packets when data is added automatically


Making dreams possible, one line at a time...
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 6th Feb 2009 19:03
I was having that problem when using UDP Per Client mode. (see my post, 3rd one down on page 8)

From the server you have to add an Integer containing the client number that this packet is "about", this should be 0 if it's about the server, or if you'd rather handle that in your own way in the packet.

If I didn't have this added first, it crashed the client.

kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 6th Feb 2009 22:03 Edited at: 6th Feb 2009 22:11
Oneka,

ALL of my packets have either got an operation or an operation and client number.

KISTech,

All my packets have valid client numbers

Quote: "I have some questions which will help me to diagnose the problem, if you can answer these then I can check over relevant code and see if there is anything wrong:

1. Without UDP are you using mnDisableUDP?
2. What UDP mode are you using?
3. When you say crash, what exactly do you mean i.e does the server/client exit unexpectedly with no error message?

[edit]
Another question:
4. Are you using mnSetFunction?"


1. No
2. Per Client Per Operation
3. The server stops accepting new connections (using game or remote desktop), no error message.
4. No

Thanks for looking into it. This is really bugging me and the whole team

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 7th Feb 2009 09:13 Edited at: 21st May 2009 14:42
@ kaedroho
It is most likely that MikeNet doesn't like a UDP packet that is being received. Remember that you can only use operation IDs up to and not including the maximum number of operations, so if 5 is the maximum number of operations you can use 0,1,2,3,4.

Also, if you are using encryption with UDP you must use mnSetDecryptUDP so that MikeNet can still read your packets.

To determine exactly what is going on, I have written a debug version of v1.1.1 which displays a message box whenever any disconnect action is taken on either the client or server. This version is attached to this post, and the new error messages look like:


Please post screenshots of all error messages that appear whilst a client is unable to connect. I will then be able to explain what is happening and what these messages mean.

@ All
I have more or less finished the uPnP code and now just need to implement it in MikeNet. This will enable you to setup port forwarding without input from the user. As well as this, you can gather information about uPnP devices on the network and edit/delete other port forwarding entries.

kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 7th Feb 2009 09:52 Edited at: 7th Feb 2009 11:27
The crash is caused by a client disconnecting, The actual crash is when the server stops accepting new connections with the game or remote desktop. Which can only be solved by closing and reopening the server program.

Im building my game again with the debug version to see if anything happens.

[edit] Built. I just got to wait for another member of the team to come online (crashes only happen when theres been more than 1 player on the server)

[edit 2] Server crashed and I have errror messages.

It looks like its a problem with the code which forwards a packet to say when a client has disconnected. I dont see why UDP prevents it from crashing. And it doesnt crash every time, It takes about 3 or 4 disconnects to finally crash it.


Heres the code thats possibly causing the crash:



Error Messages are attached.


The Crash and all the error messages happen before the cout command is called.
If I press ok to all the messages it will eventually say that the client has disconnected.


If you look at the attached image, you will see 3 errors. The top one comes up when I disconnect. The middle and bottom error messages both appear when I attempt to reconnect again but fail.

Attachments

Login to view attachments
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 7th Feb 2009 10:27 Edited at: 7th Feb 2009 10:27
[removed]

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 7th Feb 2009 17:22 Edited at: 21st May 2009 14:43
1. Do all 3 error messages occur on the server side?
2. Does the middle error message (related to _SendTCP) occur before the last error message (related to OverlappedRecvTCP)?
3. Do the 3 error messages occur before cout?

It looks like the handshaking process fails between the client and the server during connection. It fails at the point where the server tries to send a TCP packet to the new client. This is very strange, and I would say that it is not a problem with MikeNet; most likely other hardware or software are interfering with either the server or the client.

I suggest running the server on another machine to see if the problems can be replicated. If they can, then you can email me your code and I can debug it for you. As well as this, I added some more debug code that will display information about the _SendTCP error so that we know exactly why the error occurred. This new version is attached and if you decide to use it, please send me another screenshot.

kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 8th Feb 2009 12:08 Edited at: 8th Feb 2009 12:27
1. yes
2. yes
3. yes

Rebuilding with new debug.

[edit]


Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 8th Feb 2009 14:08 Edited at: 21st May 2009 14:43
Quote: "1. yes
2. yes
3. yes"


My last post assumed these answers; it looks like external factors are to blame for the problems you are experiencing.

The linker errors suggest a problem with standard strings . I have switched to doing the new debug purely with C strings, it should now work for you (see attached version).

kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 8th Feb 2009 22:45
Here you go.

Yet again thanks for looking into this.

Attachments

Login to view attachments
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 8th Feb 2009 23:56 Edited at: 21st May 2009 14:43
Winsock error 10054 is occuring when the server tries to send a TCP packet to the client. Here is a brief explanation of what this error means quoted from this website.

Quote: "Winsock error 10054 is "Connection reset by peer", or "An existing connection was forcibly closed by the remote host". The error means exactly what it says - the remote host closed the connection unexpectedly. This happens when a connection is aborted, and there is no tcp disconnection handshake (fin, fin ack, ack) , but instead a rst (reset) flag is sent. A reset flag aborts the connection, and can be sent when:
- The device is suddenly stopped, rebooted, or loses its network connection.
- The device uses a "hard close". With IP*Works! a hard close never occurs unless you specifically set the Linger property (IPPort, IPDaemon) to false.
- A "half-open connection" state occurs. That is, when one device not been receiving acknowledgements of the data it has sent, or it receives acknowledgement for an unrecognized sequence or ack number, it will send a rst flag to reset the connection. This particular case could have a variety of its own causes, such as misconfigured proxy/firewall or network quality issues resulting in too many dropped packets."


As explained above, this error can be caused by external problems such as "misconfigured proxy/firewall or network quality issues resulting in too many dropped packets" which I believe is the most likely cause.

However, it can also be caused by a hard close which is what happens when MikeNet closes sockets. This occurs on the client side when it disconnects. A client can disconnect unexpectedly in several situations which could be the cause of the problem. If the client is terminating the connection then it could be a client side issue.

I have added some more debug code to this version (debug v5) to check for this. When using this version: if you try to connect to the server and fail an error message may be displayed on the client side which will have the title: "(client side) MikeNet Debug Note". If an error message is displayed then please post a screenshot, ensuring that the order of errors is specified as the first error normally leads to further errors.

To summarise: This debug version will probably not reveal much more on the cause of the issue. Currently, everything points towards some sort of external issue, most likely server related.

[edit] Added error code display for new error messages.

Login to post a reply

Server time is: 2024-03-29 10:21:42
Your offset time is: 2024-03-29 10:21:42