2017-11-22 19:39:24 +01:00
|
|
|
|
using Godot;
|
|
|
|
|
using Network.PacketHandling;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Network {
|
|
|
|
|
public class Server : Peer {
|
|
|
|
|
|
|
|
|
|
private static PacketPeerUDP PacketPeer;
|
|
|
|
|
|
|
|
|
|
private PacketBuffer TempBuffer;
|
|
|
|
|
|
2017-11-25 11:26:55 +01:00
|
|
|
|
public Server(PacketPeerUDP packetPeer) : base(packetPeer, true) {
|
2017-11-22 19:39:24 +01:00
|
|
|
|
PacketPeer = packetPeer;
|
2017-11-25 11:26:55 +01:00
|
|
|
|
TempBuffer = PacketBuffer.WithSignature();
|
2017-11-23 01:41:37 +01:00
|
|
|
|
TempBuffer.Write(150);
|
|
|
|
|
TempBuffer.Write(145);
|
|
|
|
|
TempBuffer.Write(154);
|
|
|
|
|
TempBuffer.Write(154);
|
|
|
|
|
TempBuffer.Write(157);
|
2017-11-22 19:39:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Initialize(string address, int port) {
|
|
|
|
|
StartListening(port, address);
|
|
|
|
|
GD.print("Server initialization finished.");
|
|
|
|
|
GD.print("Started server on " + address + ":" + port);
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-25 11:26:55 +01:00
|
|
|
|
public override void Process(float delta) {
|
2017-11-22 19:39:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Connected(Connection conn) {
|
|
|
|
|
GD.print("Someone connected at " + conn.Address + ":" + conn.Port);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|