Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
When we Use Local TCP/IP then this code work fine.But In case of Direct TCP/IP this code is not working. Can any one help me how we modify to turn off the ssl in server from this code.

C#
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;
       }
Posted
Comments
Yvan Rodrigues 25-Feb-14 8:36am    
What does SSL have to do with it?
What is working, what isn't.
piushshukla 25-Feb-14 8:49am    
Actually In Case of Direct TCP/Ip we send SSl ON.In case of direct tcp/ip we found an Socketexception " An existing connection was forcibly closed by the remote host"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900