public IncomingMessage(RdpConnection rdpConn) { IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0); byte[] buf = rdpConn.Receive(ref remoteEP); Init(buf, 0, buf.Length, remoteEP); }
public void Send(RdpConnection rdpConn) { writer.Flush(); try { rdpConn.Send(memStream.ToArray()); } catch (RdpFragmentationException) { log.Error("Failed to send packet that was too large"); } }
public TestClass() { SetupDebug(); // const int ServerPort = 200; const int ServerPort = 5001; const int ClientPort = 6666; IPHostEntry IPHost = Dns.GetHostEntry("cedeno-dxp.corp.multiverse.net"); IPAddress[] addr = IPHost.AddressList; IPEndPoint sendpt = new IPEndPoint(addr[0], ServerPort); RdpClient rdpClient = new RdpClient(ClientPort, 100, 1000, true); RdpClient rdpClient2 = new RdpClient(ClientPort + 1, 100, 1000, false); //RdpServer rdpServer = new RdpServer(ServerPort, 100, 1000, true); RdpConnection rdpClientConn = rdpClient.Connect(sendpt); RdpConnection rdpClientConn2 = rdpClient2.Connect(sendpt); // RdpConnection rdpServerConn = rdpServer.Accept(); rdpClientConn.WaitForState(ConnectionState.Open); rdpClientConn2.WaitForState(ConnectionState.Open); // Console.WriteLine("Server State = " + rdpServerConn.ConnectionState); Console.WriteLine("Client State = " + rdpClientConn.ConnectionState); OutgoingMessage outMessage = new OutgoingMessage(); outMessage.Write("Good morning"); outMessage.Send(rdpClientConn); outMessage.Send(rdpClientConn2); // byte[] msg = Encoding.ASCII.GetBytes("Test"); // rdpClientConn.Send(msg); // rdpClientConn.Send(msg); // rdpClientConn.Send(msg); IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0); IncomingMessage inMessage; inMessage = new IncomingMessage(rdpClientConn); Console.WriteLine("Got message: {0}", inMessage.ReadString()); inMessage = new IncomingMessage(rdpClientConn2); Console.WriteLine("Got message2: {0}", inMessage.ReadString()); // for (int i = 0; i < 3; ++i) { // byte[] rcvdMessage = rdpServerConn.Receive(ref remoteEP); // Console.WriteLine("Server got message from {1}: '{0}'", // Encoding.ASCII.GetString(rcvdMessage), remoteEP); // rdpServerConn.Send(msg); // } // // for (int i = 0; i < 3; ++i) { // byte[] rcvdMessage = rdpClientConn.Receive(ref remoteEP); // Console.WriteLine("Client got message from {1}: '{0}'", // Encoding.ASCII.GetString(rcvdMessage), remoteEP); // } // // rdpServerConn.Close(); Thread.Sleep(100); // Console.WriteLine("Server State = " + rdpServerConn.ConnectionState); Console.WriteLine("Client State = " + rdpClientConn.ConnectionState); Thread.Sleep(31000); // Console.WriteLine("Server State = " + rdpServerConn.ConnectionState); Console.WriteLine("Client State = " + rdpClientConn.ConnectionState); FinishDebug(); //rdpConn.Open(false, 1, 2, 3, 4, true); //rdpConn.Send(new Multiverse.Network.Rdp.RdpPacket(50)); //this.Hide(); //this.WindowState = FormWindowState.Minimized; }
public static void connectionReset(RdpConnection con) { // do nothing }