More work on the world server.

This commit is contained in:
Filip Maj 2016-08-23 16:57:24 -04:00
parent e24a6f99cb
commit a1ca960543
7 changed files with 248 additions and 15 deletions

View file

@ -5,6 +5,7 @@ using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using FFXIVClassic.Common;
namespace FFXIVClassic_World_Server.DataObjects
{
@ -12,6 +13,7 @@ namespace FFXIVClassic_World_Server.DataObjects
{
public readonly string zoneServerIp;
public readonly int zoneServerPort;
public readonly int[] ownedZoneIds;
public bool isConnected = false;
public Socket zoneServerConnection;
@ -36,5 +38,21 @@ namespace FFXIVClassic_World_Server.DataObjects
catch (Exception e)
{ Program.Log.Error("Failed to connect"); return; }
}
public void SendPacket(SubPacket subpacket)
{
if (isConnected)
{
byte[] packetBytes = subpacket.GetBytes();
try
{
zoneServerConnection.Send(packetBytes);
}
catch (Exception e)
{ Program.Log.Error("Weird case, socket was d/ced: {0}", e); }
}
}
}
}