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.1
6.81");
IPEndPoint hostep = new IPEndPoint(IPAdd, 25);
Socket sock = new Socket(AddressFamily.Inter
Network, SocketType.Stream, ProtocolType.Tcp);
sock.Connect(hostep);
sock.Send(Encoding.ASCII.G
etBytes(us
erPacket))
;
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