internal void receiveData(IPV4.TCP.TCPPacket packet) { byte[] data = packet.TCP_Data; IPV4.EndPoint source = new IPV4.EndPoint(packet.SourceIP, packet.SourcePort); Console.WriteLine("\nReceived TCP Packet (" + data.Length + "bytes) from " + source.ToString()); Console.WriteLine("Content: " + Encoding.ASCII.GetString(data)); this.rxBuffer.Enqueue(new DataGram(data, source)); }
//from ip, port, incoming bool, outcoming bool //192.168.1.1, 25565, true, true public static bool TCPIncomingFilter(IPV4.TCP.TCPPacket packet) { IPV4.Address IPSource = packet.SourceIP; ushort Port = packet.SourcePort; for (int i = 0; i < TCPFilterList.Count; i++) { if (TCPFilterList[i].Contains(IPSource.ToString() + "," + Port.ToString() + ",true")) { //string[] FilterList = TCPFilterList[i].Split(','); //bool INCOMING = bool.Parse(FilterList[2]); return(true); } if (TCPFilterList[i].Contains(IPSource.ToString() + ",*,true")) { //string[] FilterList = TCPFilterList[i].Split(','); //bool INCOMING = bool.Parse(FilterList[2]); return(true); } } return(false); }