sockscape/server/Socks/PendingConnection.cs

31 lines
761 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
2017-05-12 21:05:18 +00:00
using Square;
using Kneesocks;
namespace CircleScape {
2017-05-12 21:05:18 +00:00
class PendingConnection : Connection {
private DateTime ConnectionOpened;
2017-05-17 21:06:16 +00:00
2017-05-12 21:05:18 +00:00
protected override void OnOpen() {
ConnectionOpened = DateTime.UtcNow;
}
protected override void OnParse() {
if((DateTime.UtcNow - ConnectionOpened).Seconds > 60) {
Disconnect(Frame.kClosingReason.ProtocolError, "Logon request timed out.");
}
}
protected override void OnReceive(byte[] data) {
Console.WriteLine(Id + " says " + data.GetString());
}
}
}