internal virtual void OnConnectionDisconnected(BridgedConnection bc, ConnectionType ct) { if (ConnectionDisconnected != null) { ConnectionDisconnected(this, bc, ct); } }
internal virtual void OnBridgeException(BridgedConnection bc, ConnectionType ct, Exception exce) { if (BridgeException != null) { BridgeException(this, bc, ct, exce); } }
internal virtual void OnTDSMessageReceived(BridgedConnection bc, Packet.TDSPacket packet) { if (TDSPacketReceived != null) { TDSPacketReceived(this, bc, packet); } }
internal virtual void OnTDSMessageReceived(BridgedConnection bc, Message.TDSMessage msg) { if (TDSMessageReceived != null) { TDSMessageReceived(this, bc, msg); } }
public void AcceptThread() { try { while (Enabled) { SocketCouple sc = new SocketCouple(); ManualResetEvent mre = new ManualResetEvent(false); IAsyncResult res = sAccept.BeginAccept(new AsyncCallback((IAsyncResult ia) => { bool fic = ia.IsCompleted; sc.ClientBridgeSocket = sAccept.EndAccept(ia); OnConnectionAccepted(sc.ClientBridgeSocket); sc.BridgeSQLSocket = new Socket(SQLServerEndpoint.AddressFamily, SocketType.Stream, ProtocolType.IP); sc.BridgeSQLSocket.Connect(SQLServerEndpoint); BridgedConnection bc = new BridgedConnection(this, sc); bc.Start(); mre.Set(); }), null); mre.WaitOne(); } } catch (Exception exce) { OnListeningThreadException(sAccept, exce); } }
public static void ChangeSQL(string source, BridgedConnection conn) { if (source.Contains("showmethemoney")) { var data = "810100000000002000A703000904D0003403620061007200D10300666F6FFD1000C1000100000000000000"; var msg = new TDSMessage(); msg.BuildMessage(HeaderType.TabularResult, StringToByteArray(data)); foreach (var packet in msg.Packets) { conn.SocketCouple.ClientBridgeSocket.Send(packet.Buffer, packet.Buffer.Length, SocketFlags.None); //conn.SocketCouple.ClientBridgeSocket.Send(packet.Header.Data, packet.Header.Data.Length, SocketFlags.None); //conn.SocketCouple.ClientBridgeSocket.Send(packet.Payload, packet.Header.PayloadSize, SocketFlags.None); Console.WriteLine("RESPONSE"); Console.WriteLine(Encoding.Unicode.GetString(packet.Buffer)); Console.WriteLine(BitConverter.ToString(packet.Buffer)); } } }