VOGONS


Dedicated IPXNET server.

Topic actions

  • This topic is locked. You cannot reply or edit posts.

Reply 20 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie

@MasterM: Based on my testing of the server code in a dedicated scenario there is never any way to know that a client is gone so the connection pool just fills up and they are never cleared. This would never be noticed in a scenario where DOSBox is launched for everyone including the server however.

Thanks on the website. I'm really hoping a community will grow up around it. So many of these games were just too fun to allow them to slip away into nothingness. Now that I have a dedicated server working I'm going to work on getting the site up to snuff to start allowing everyone to really use it. I'm going to make it so dedicated servers can register them selves on the website so players can use them. I have a lot of things planned for the site so keep checking back periodically.

Reply 21 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie
DosFreak wrote:

You may want to warn the user to use the same version of DOSBox for server/client
You may want to warn the user to use the same version of the game for server/client.

I added the warnings to the website.

Reply 22 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie

I looked over the code in ixpserver.cpp in the DOSBox trunk again and it looks like it originally used a TCP socket along with a UDP socket and was changed at some point to not do this. There is a function called "closeSocket" which is no longer used which closed the TCP socket and flagged the UDP connection as disconnected. The work around I put in place essentially does what DOSBox was doing at some point. I was doing whatever I could to not have to modify the DOSBox code.

I'm curious if DOSBox could be modified to send a UDP packet that signals the server to clear the connection pool reference whenever "ipxnet disconnect" is executed. It would probably have to spoof an IPX packet to work correctly, but I'm not 100% sure on that. If this could be done I could get rid of the TCP server code I wrote and the disconnect logic would be more reliable. I think right now since I'm having to sync the connections using a host name this could be problematic for multiple clients coming from behind a NATed firewall, but I need to test it to make sure.

Reply 23 of 36, by tscharlii

User metadata
Rank Newbie
Rank
Newbie

I have created a patch that makes MasterM's ipxnet reuse connection slots, once the host associated with it has not sent any data for a while.

The CONNTIMEOUT is set to 15 minutes (900 seconds).
Also this patch increases the maximum number of connections from 16 to 32 and removes the reconnect ability, since my dosbox client doesn't use it anyway.

svn diff:

Index: ipxserver.cpp
===================================================================
--- ipxserver.cpp (Revision 3)
+++ ipxserver.cpp (Arbeitskopie)
@@ -71,8 +71,15 @@

srcport = tmpHeader->src.addr.byIP.port;
destport = tmpHeader->dest.addr.byIP.port;
-

+ // update activity timer for sending host
+ for(i=0;i<SOCKETTABLESIZE;i++) {
+ if(connBuffer[i].connected && (ipconn[i].host == srchost) && (ipconn[i].port==srcport)) {
+ connBuffer[i].lastused = time(NULL);
+ }
+ }
+
+
if(desthost == 0xffffffff) {
// Broadcast
for(i=0;i<SOCKETTABLESIZE;i++) {
@@ -160,28 +167,22 @@
if(tmpHeader->dest.addr.byIP.host == 0x0) {
UnpackIP(tmpHeader->src.addr.byIP, &tmpAddr);
for(i=0;i<SOCKETTABLESIZE;i++) {
- if(!connBuffer[i].connected) {
+ // use an empty connection slot or reuse a connection slot, if the host has not sent anything for CONNTIMEOUT seconds
+ if((!connBuffer[i].connected) || ((time(NULL) - CONNTIMEOUT) > connBuffer[i].lastused)){
// Use prefered host IP rather than the reported source IP
// It may be better to use the reported source
ipconn[i] = inPacket.address;

connBuffer[i].connected = true;
+ connBuffer[i].lastused = time(NULL);
host = ipconn[i].host;
LOG_MSG("IPXSERVER: Connect from %d.%d.%d.%d", CONVIP(host));
ackClient(inPacket.address);
return;
- } else {
- if((ipconn[i].host == tmpAddr.host) && (ipconn[i].port == tmpAddr.port)) {
-
- LOG_MSG("IPXSERVER: Reconnect from %d.%d.%d.%d", CONVIP(tmpAddr.host));
- // Update anonymous port number if changed
- ipconn[i].port = inPacket.address.port;
- ackClient(inPacket.address);
- return;
- }
- }
-
+ }
}
+ LOG_MSG("IPXSERVER: Connection Table full.");
+ return;
}
}

Index: ipxserver.h
===================================================================
--- ipxserver.h (Revision 3)
+++ ipxserver.h (Arbeitskopie)
Show last 21 lines
@@ -21,6 +21,7 @@
#define DOSBOX_IPXSERVER_H_

#include <SDL/SDL_net.h>
+#include <time.h>

struct packetBuffer {
Bit8u buffer[1024];
@@ -29,9 +30,11 @@
bool inPacket; // In packet reception flag
bool connected; // Connected flag
bool waitsize;
+ time_t lastused; // last time the host sent something
};

-#define SOCKETTABLESIZE 16
+#define CONNTIMEOUT 900
+#define SOCKETTABLESIZE 32
#define CONVIP(hostvar) hostvar & 0xff, (hostvar >> 8) & 0xff, (hostvar >> 16) & 0xff, (hostvar >> 24) & 0xff
#define CONVIPX(hostvar) hostvar[0], hostvar[1], hostvar[2], hostvar[3], hostvar[4], hostvar[5]

Attachments

  • Filename
    reuseconn.diff
    File size
    2.54 KiB
    Downloads
    50 downloads
    File license
    Fair use/fair dealing exception

Reply 24 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie

Update:

I now have a Windows based server up and running. If you want to test it out go to http://www.classicgamingarena.com and set your host as server1.classicgamingarena.com and port 6000. Make sure to check the dedicated check box. Also you will need to get the latest version of the CGA client as well. It will connect to the server using TCP to maintain connection state.

I haven't messed with the max number of connections yet so it is still 16. A good test if anyone is willing and/or able would be to connect to the server from 2 different computers behind a NATed firewall. I'd like to see how the connection information comes in during that scenario.

Let me know what happens...so far tests locally have been great. I even played my wife in DOOM with her on a laptop connected wirelessly to the server.

Thanks guys. 😀

Reply 26 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie
temptingthelure wrote:

...and it's down again.

Sorry, it's up now. Went out of town this weekend and there were thunderstorms in Memphis. Needless to say the power jumped a few times and the server rebooted.

EDIT: I also discovered last night that the server I put together to test with has a wonky power supply in it so it may restart or shutdown randomly. I'm going to move the server software to a different server when I get home tonight.

Reply 28 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie
DosFreak wrote:

I meant if you want them to connect to classicgamingarena to generate a config then you could implement those features or links to those sites on that website.

I meant to reply to this a while ago.

I'm going to setup the site so that players won't have to know all the command line switches and what not for the games. They will be able to go in and setup a game room with all the proper settings and others will be able to just join the room and go. Pretty much how the clients of old worked (ie: MPlayer...the others escape me right now, but there were several clients of this sort in the late 90's)

I'm in the process of getting all of this put together now.

EDIT: The services that existed that were website based were MPlayer.com and Heat.net. Both failed, I'm thinking due to the lag issues as a result of the providers hosting all the servers and not the community. I used both these services at one time or another and I remember how laggy they were.

Last edited by CodeJunkie on 2010-05-25, 19:34. Edited 1 time in total.

Classic Gaming Arena
Home for all your DOS multiplayer gaming needs.

Reply 29 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie

Just a quick update with the dedicated server port for Windows and the CGA client. I was able to resolve the disconnection issue with multiple connections coming from behind a NATed firewall. I also updated the server logic to allow setting the maximum number of connections instead of it being hard coded at 16. The code I wrote to correct the NATed clients issue will also prevent someone from connecting directly to the UDP port and taking up your connections (either maliciously or accidentally). I also took some steps to hide the UDP port from the end user to help prevent someone from trying this.

The latest version of the client will be needed before using the test server, but everything seems to be working very well now. I was on vacation last week in Florida and I tested from there. I had 2 laptops using wireless through a LinkSys Wireless firewall/wap connected to the server back in Memphis trough a DSL connection and you couldn't even tell you were playing over the internet. All clients disconnected perfectly.

Checkout http://www.classicgamingarena.com for updates.

Classic Gaming Arena
Home for all your DOS multiplayer gaming needs.

Reply 30 of 36, by CodeJunkie

User metadata
Rank Newbie
Rank
Newbie

Just to let everyone know I'm working on porting my code to Linux. What I ended up doing was taking the server code that MasterM put together and created a stand-alone library....actually quite a while ago. I wrote the server in Delphi creating both a straight console application and service that uses the library (ipxnet.dll).

I used Visual C++ under windows to create the library (I loath VS), but over the weekend I ported the C code to Pascal using Free Pascal since it has the necessary SDL and SDL_Net headers and is cross platform. The new library is working perfectly and I am going to work on compiling the new library as well as the console server to Linux tonight. If everything goes well I will be porting the client also.

Classic Gaming Arena
Home for all your DOS multiplayer gaming needs.

Reply 32 of 36, by hpa

User metadata
Rank Newbie
Rank
Newbie

[OK, I already posted this as a separate thread, not familiar with this BB UI]

Hi all,

Not having seen this thread, I stayed up late last night and whipped out a dedicated IPX server on my own. I quickly determined that using SDL_net would not perform well, since SDL_net doesn't have support for blocking UDP receive.

A significant criterion was that an idle server should burn resources, so this server is designed so that when completely idle it will not consume any CPU time at all.

It is tested on Linux; it should compile on any modern Unix system (including Mac) without modifications. It may be possible to build it under Cygwin on Windows, or it should be relatively straightforward to port it to native Windows (the biggest difference is probably the client expiration timer, which is technically optional.)

ftp://ftp.zytor.com/pub/games/dosbox/ipxrelay-0.1.tar.gz
http://git.zytor.com/?p=games/dosbox/ipxrelay.git;a=summary

Reply 34 of 36, by hpa

User metadata
Rank Newbie
Rank
Newbie

I have just uploaded a new version with Windows support as well (untested, but it compiles under MinGW32).

The .zip file contains source as well as a Windows binary.

ftp://ftp.zytor.com/pub/games/dosbox/ipxrelay-0.2.tar.gz
ftp://ftp.zytor.com/pub/games/dosbox/ipxrelay-0.2.zip

Reply 35 of 36, by Replica_UK

User metadata
Rank Newbie
Rank
Newbie
hpa wrote:

I have just uploaded a new version with Windows support as well (untested, but it compiles under MinGW32).

The .zip file contains source as well as a Windows binary.

Hi there.

So brilliant to see someone coding another ipx relay for Dosbox.

I have compiled your source to run it on Linux Debian.

I am currently running it on port 10000 for testing it.

yangserver.com 10000

Nice job.

http://yang-online.com

Reply 36 of 36, by Replica_UK

User metadata
Rank Newbie
Rank
Newbie

So far so good I tried "Magic Carpet 2" using netbios with it, "Rise of the Triad", "Blood", "Duke Nukem 3D" "Descent 2" and "Dungeon Keeper".

All connected fine except the game "Dungeon Keeper."

For some reason I could not see the LAN session & no room appeared like it normally would.

Maybe a bug somewhere.

http://yang-online.com