27 namespace Ntp.Analyzer.Monitor.Client
36 public byte[]
Send(
string command)
38 var clientSocket =
new Socket(
39 AddressFamily.InterNetwork,
43 clientSocket.Connect(Server);
45 byte[] sendBuffer = Encoding.UTF8.GetBytes(command);
48 clientSocket.Send(sendBuffer, 0, sendBuffer.Length, SocketFlags.None, out error);
50 const int size = 4096;
52 var stream =
new MemoryStream(size);
53 var buffer =
new byte[size];
59 length = clientSocket.Receive(buffer, 0, size, SocketFlags.None, out error);
60 stream.Write(buffer, 0, length);
63 clientSocket.Shutdown(SocketShutdown.Both);
66 return stream.ToArray();
byte[] Send(string command)
BinaryRequest(IPAddress ip, int port)