GodotTicTacToe/scripts/net/Server.cs

35 lines
1.0 KiB
C#

using Godot;
using Network.PacketHandling;
using System.Threading;
namespace Network {
public class Server : Peer {
private static PacketPeerUDP PacketPeer;
private PacketBuffer TempBuffer;
public Server(PacketPeerUDP packetPeer) : base(packetPeer, true) {
PacketPeer = packetPeer;
TempBuffer = PacketBuffer.WithSignature();
TempBuffer.Write(150);
TempBuffer.Write(145);
TempBuffer.Write(154);
TempBuffer.Write(154);
TempBuffer.Write(157);
}
public override void Initialize(string address, int port) {
StartListening(port, address);
GD.print("Server initialization finished.");
GD.print("Started server on " + address + ":" + port);
}
public override void Process(float delta) {
}
public override void Connected(Connection conn) {
GD.print("Someone connected at " + conn.Address + ":" + conn.Port);
}
}
}