Advertisement

06.05.2008 at 11:19PM PDT, ID: 23462808
[x]
Attachment Details

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Asked by rengsons in Network Operations, Microsoft Visual C#.Net, Visual Studio .NET 2005

Tags: Microsoft, Visual Studio 2005, C#, interfacing

Hai,
i am doing one project in C# windows application.This project is used to interfacing with another one data.I can transfer  data to that device by using TCP/IP with port 25.But When i transfer bulk of data from PC to device,follwing error occured.
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ".
                      For examble I need to send 10 number of data one by one.In that i can send 5 number of data successfully(can receive the ack also).But when i send 6th data. the above error may occur.
After some seconds i can send the remaining data(Some times i have to restart the device).
I hope you can understand mine situation. My code is given as below

                        IPAddress IPAdd = IPAddress.Parse("192.168.16.81");
                        IPEndPoint hostep = new IPEndPoint(IPAdd, 25);
                        Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        sock.Connect(hostep);
                        sock.Send(Encoding.ASCII.GetBytes(userPacket));
                        sock.ReceiveBufferSize = 1024;
                        byte[] data = new byte[1024];
                        sock.ReceiveTimeout = 3000;
                        sock.Receive(data);
                        string recevedData = "";
                        recevedData = System.Text.Encoding.ASCII.GetString(data);
                     
Please guide me to solve this problem.
                       Start Free Trial
 
 
[+][-]06.05.2008 at 11:34PM PDT, ID: 21726675

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 01:37AM PDT, ID: 21727207

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Network Operations, Microsoft Visual C#.Net, Visual Studio .NET 2005
Tags: Microsoft, Visual Studio 2005, C#, interfacing
Sign Up Now!
Solution Provided By: Thejaka
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628