private String PReq_To_CGServer() { const int MaxBuf = 1024; byte[] TransBuf = new byte[MaxBuf]; String PLRequest = "<PLRequest><Command>BATCHSUMMARY</Command><Id>123</Id><ClientId>04</ClientId></PLRequest>"; String PLResponse = "None"; Socket PLClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); try { PLClientSocket.Connect(System.Net.IPAddress.Parse("127.0.0.1"), 8000); PLClientSocket.Send(System.Text.Encoding.ASCII.GetBytes(PLRequest)); if (PLClientSocket.Receive(TransBuf, MaxBuf, SocketFlags.None) > 0) { PLResponse = System.Text.Encoding.ASCII.GetString(TransBuf); } PLClientSocket.Close(); } catch (SocketException ex) { PLResponse = ex.Message; } return PLResponse; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)