RDP via Bluetooth

This is a R&D project. Windows ceiling for PC to mobile phone via Bluetooth. I have succeeded in streaming the desktop to my Android phone with 720p, but the fact is that I can not get live broadcast. Encoding and transmitting data via Bluetooth takes a few milliseconds, so this is not so. So what I did, I chose RDP for this. Because RDP is built for LAN only. I do not have a profile for PAN. I wrote a proxy server that only routes RDP packets from the local host to my computer via Bluetooth. On the computer side, there is another program that takes data from bluetooth and sends this data to localhost port 3389. Now the problem that I am facing is that when the connection is initiated, the socket becomes closer. The program first reads only 80 or 45 bytes, then a "Socket Closed" exception is thrown. My question is: does RDP open and close sockets for the session, or connect for the first time, and then use that socket. Since I am new to this RDP job. suggest me some topic about RDP. Any help is appreciated.

Regards Moonzai

UPDATE:

I use the following code to read and write to and from Bluetooth and Socket.

class ReadWrite implements Runnable { private String name; private Thread thread; private InputStream is; private OutputStream os; private volatile boolean start = false; public ReadWrite(String name, InputStream is, OutputStream os) { this.name = name; this.is = is; this.os = os; thread = new Thread(this); } public void startThread() { start = true; thread.start(); } public void stopThread() { start = false; try { if (is != null) { is.close(); } if (os != null) { os.close(); } } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { System.out.println(name + " ReadWrite Started"); byte[] buffer = new byte[8092]; int read; while (start) { try { read = is.read(buffer); System.out.println(name + " Read: " + read); if (read > 0) { os.write(buffer, 0, read); os.flush(); } } catch (Exception e) { e.printStackTrace(); break; } } System.out.println(name + " ReadWrite Stopped"); } } 

I run 2 instances of this thread, for example:

  ReadWrite bt2net = new ReadWrite("bt2net", btis, netos); ReadWrite net2bt = new ReadWrite("net2bt", netis, btos); bt2net.startThread(); net2bt.startThread(); 

where btis , netos , netis and btos are InputStream and OutputStream . This class is used on both sides of Android and PC. The PC side works with a read length of -1, while the Android side gives me this exception:

  java.net.SocketException: Socket closed java.io.IOException: bt socket closed, read return: -1 

I do not know what and why this is happening. Please put a little light on the low RDP, as I did not find any useful information.

+6
source share
1 answer

Yes, it looks like RDP opens and closes sockets when connected. I just did a batch capture of the RDP connection from a Windows Vista computer to a Windows Server 2003 R2 server, and there are two TCP streams. The first TCP stream consists of 19 bytes in one direction, then 19 bytes back in the other direction, similar to how you describe. After a second, another TCP connection is configured, and this lasts until the end of the session.

Good luck with your project!

0
source

Source: https://habr.com/ru/post/974292/


All Articles