Networking Finally starting to be added :D
This commit is contained in:
parent
c00c9b08b9
commit
3227210590
3 changed files with 83 additions and 0 deletions
|
@ -69,6 +69,8 @@
|
||||||
<Compile Include="GameObjects\Environment\Zone.cs" />
|
<Compile Include="GameObjects\Environment\Zone.cs" />
|
||||||
<Compile Include="GameObjects\Items\BaseItem.cs" />
|
<Compile Include="GameObjects\Items\BaseItem.cs" />
|
||||||
<Compile Include="GameObjects\Currency.cs" />
|
<Compile Include="GameObjects\Currency.cs" />
|
||||||
|
<Compile Include="Networking\Server.cs" />
|
||||||
|
<Compile Include="Networking\Socket.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Scripting\GameObject.cs" />
|
<Compile Include="Scripting\GameObject.cs" />
|
||||||
<Compile Include="Scripting\GameObjectCollection.cs" />
|
<Compile Include="Scripting\GameObjectCollection.cs" />
|
||||||
|
|
21
MudEngine/Networking/Server.cs
Normal file
21
MudEngine/Networking/Server.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using MudEngine.Networking.Socket;
|
||||||
|
|
||||||
|
namespace MudEngine.Networking
|
||||||
|
{
|
||||||
|
class Server
|
||||||
|
{
|
||||||
|
public Server()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public ~Server()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Socket server;
|
||||||
|
}
|
||||||
|
}
|
60
MudEngine/Networking/Socket.cs
Normal file
60
MudEngine/Networking/Socket.cs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MudEngine.Networking
|
||||||
|
{
|
||||||
|
public const int UDP = 2;
|
||||||
|
class Socket
|
||||||
|
{
|
||||||
|
public Socket()
|
||||||
|
{
|
||||||
|
type = 0;
|
||||||
|
}
|
||||||
|
public ~Socket()
|
||||||
|
{
|
||||||
|
type = 0;
|
||||||
|
}
|
||||||
|
// all methods return int, 1 = success, -1 = error, > 1 are just extra info w/ success
|
||||||
|
// < -1, known error find it out with: (string)getError(er_code);
|
||||||
|
|
||||||
|
public int init()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public int start()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public int bind()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public int listen()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public int accept()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public int end()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public string getError(int er_code)
|
||||||
|
{
|
||||||
|
if (er_code > 0)
|
||||||
|
return "No Error";
|
||||||
|
switch (er_code)
|
||||||
|
{
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "Unknown Error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int type; // 1 = TCP, 2 = UDP
|
||||||
|
private int stage;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue