mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Implement new System.Net.Sockets debugger
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Microsoft.Iris.Debug;
|
||||
|
||||
@@ -7,9 +11,34 @@ namespace Microsoft.Iris.Debug;
|
||||
/// </summary>
|
||||
public static class DebugRemoting
|
||||
{
|
||||
public const string DEFAULT_TCP_CLIENT_URI = ">tcp://127.0.0.1:5555,@tcp://127.0.0.1:55556";
|
||||
public const string DEFAULT_TCP_CLIENT_URI = ">tcp://127.0.0.1:5555,@tcp://127.0.0.1:5556";
|
||||
public const string DEFAULT_TCP_SERVER_URI = "@tcp://127.0.0.1:5555,>tcp://127.0.0.1:5556";
|
||||
|
||||
public const string DEFAULT_TCP_SERVER_URI = "@tcp://127.0.0.1:5555,>tcp://127.0.0.1:55556";
|
||||
public static readonly Uri DEFAULT_TCP_URI = new("tcp://127.0.0.1:5555");
|
||||
|
||||
internal static IFormatter CreateBsonFormatter() => new BsonFormatter(new StreamingContext(StreamingContextStates.Remoting));
|
||||
|
||||
internal static Data.DebuggerMessageFrame ReceiveDebuggerMessage(Socket socket)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] sizeBuffer = new byte[sizeof(int)];
|
||||
int bytesReceived = socket.Receive(sizeBuffer);
|
||||
|
||||
// Reached end of stream, no bytes to recieve
|
||||
if (bytesReceived == 0)
|
||||
return null;
|
||||
|
||||
int frameLength = BitConverter.ToInt32(sizeBuffer, 0);
|
||||
|
||||
byte[] frameBytes = new byte[frameLength];
|
||||
socket.Receive(frameBytes, frameLength, SocketFlags.None);
|
||||
|
||||
return new(frameBytes);
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user