Hosting server on NAT based network
Hello All,
I've been getting back into some Vindictus development recently and I've been wanting to run a server on my home network with the ability for friends to connect and help me test bits I've been working. I managed to figure it out and now I'm going to share with you how to do it. Use the Server Source linked by Lucs when he released how to get Delia working. I also recommend setting up a url to link to your WAN IP using ddns.net
Okay the first file which will need editing is ConnectionRequestMessage.cs in the ServiceCore.EndPointNetwork
Now the code will look like this
Code:
public ConnectionRequestMessage(IPEndPoint endpoint, DateTime dt, int key, string category)
{
this.Address = endpoint.Address.ToString();
this.Port = (ushort)endpoint.Port;
this.PosixTime = dt.ToInt32();
this.Key = key;
this.Category = category;
this.PingHostCID = -1L;
this.GroupID = 0L;
}
You will need to slightly adjust it to allow connections from your newly setup ddns address.
Code:
public ConnectionRequestMessage(IPEndPoint endpoint, DateTime dt, int key, string category)
{
//To remove DDNS alias and return to normal remove the If Statement and Else Statement and just put this.Address = endpoint.Address.ToString();
if (endpoint.Address.IsPrivateNetwork() || endpoint.Address == IPAddress.Loopback)
{
this.Address = "ThisExampleRocks.ddns.net";
}
else
{
this.Address = endpoint.Address.ToString();
}
this.Port = (ushort)endpoint.Port;
this.PosixTime = dt.ToInt32();
this.Key = key;
this.Category = category;
this.PingHostCID = -1L;
this.GroupID = 0L; }
Okay once you've finished editing ConnectionRequestMessage.cs we will need to look for. JoinChannel.cs under ServiceCore.MMOChannelServiceOperations
Code:
private class Request : OperationProcessor<JoinChannel>
{
public Request(JoinChannel op) : base(op)
{
}
public override IEnumerable<object> Run()
{
yield return null;
if (base.Feedback is JoinChannel.FailReasonEnum)
{
base.Result = false;
base.Operation.FailReason = (JoinChannel.FailReasonEnum)base.Feedback;
}
else if (base.Feedback.GetType() != typeof(string))
{
base.Result = false;
}
else
{
string address = base.Feedback as string;
yield return null;
int port = (int)base.Feedback;
yield return null;
long channelID = (long)base.Feedback;
yield return null;
int key = (int)base.Feedback;
base.Operation.addressMessage = new ChannelServerAddress
{
Address = address,
Port = port,
ChannelID = channelID,
Key = key
};
}
yield break;
}
}
Once again it will require a small edit to get your ddns url to work.
Code:
private class Request : OperationProcessor<JoinChannel>
{
public Request(JoinChannel op) : base(op)
{
}
public override IEnumerable<object> Run()
{
yield return null;
if (base.Feedback is JoinChannel.FailReasonEnum)
{
base.Result = false;
base.Operation.FailReason = (JoinChannel.FailReasonEnum)base.Feedback;
}
else if (base.Feedback.GetType() != typeof(string))
{
base.Result = false;
}
else
{
string address = base.Feedback as string;
yield return null;
int port = (int)base.Feedback;
yield return null;
long channelID = (long)base.Feedback;
yield return null;
int key = (int)base.Feedback;
base.Operation.addressMessage = new ChannelServerAddress
{
Address = address,
Port = port,
ChannelID = channelID,
Key = key
};
//Remove the base.Operation.addressMessage blow this command to remove the DDNS alias
base.Operation.addressMessage = new ChannelServerAddress
{
Address = "ThisExampleRocks.ddns.net",
Port = port,
ChannelID = channelID,
Key = key
};
}
yield break;
}
}
Once you have done this. Along as your friends have the same client and the endpoint works (Host it on any webhosting) it should allow them to connect to your server via your setup ddns link.
Have Fun :)
Re: Hosting server on NAT based network
From the outside, it seems so simple, but in fact it is quite difficult to do something like this on your own. Thank you for your help, I'm thinking with my friends to try to do everything according to your advice. What can I use this server for? We would like to make our own chat through this server, do you think this is possible?
Re: Hosting server on NAT based network
Quote:
Originally Posted by
Freedance
From the outside, it seems so simple, but in fact it is quite difficult to do something like this on your own. Thank you for your help, I'm thinking with my friends to try to do everything according to your advice. What can I use this server for? We would like to make our own chat through this server, do you think this is possible?
You really have a very interesting and cool idea. Do you want to make a chat as an application or as an additional window on a website? I think regardless of what form the chat will be in, you will really need a good hosting service. If you do not manage to implement this guide, I advise you to find an inexpensive hosting and try to buy a subscription for a week. A week of web hosting is usually not so expensive. Although not every service provides the opportunity to rent a server for a week. I think in extreme cases, you can always try to use free hosting and if everything works properly, you can find the Best Cloud Hosting and rent it for a month or even more!