If your code doesn’t crash and if you get the correct ResponseCode value in your callback routine (SocketRspCbk(…)), then it seems likely that the session is closed by remote server.
The correct ResponseCode value should be:
ED_ERR_DISTANT_TCP_CLOSED_BY_PEER
if the session is closed by remote server.
You could also test the server with a PC tool like a telnet link to the address and port of your server or by using “TCP Test Tool” from http://www.simplecomtools.com, just to see how the servers behaves.
Could you please check if the third parameter in ed_SendDataExt () function is set to TRUE or FALSE. This is becuase, if you set the third parameter of ed_SendDataExt function to TRUE, then the socket will close after sending the specified data. Only, if you set it to FALSE will the socket remain open after sending the data.
This is my code for sending the data thorugh socket:
result = ed_SendDataExt(buffer,bufferLen,FALSE,ED_ID_TCPSOCKET_1);
So this should be fine but it doesnt work.
Actually what I do is I send data thorough sockect on Port 80 which is HTTP protocol based. So could this be a problem like socket closes after data received ?
I once had the same problem. A web server was closing the port on my request without sending an answer. It turned out that the server didn’t like the formatting of my request. I used \n as line breaks and not \r\n… If you are using unix style line ends (\n) try to use \r\n instead. Maybe this helps…
Hi Jiten,
I agree with the point raised by jan. In case, the web server you are trying to send the HTTP request, does not recognise the request (due to incorrect format of request), it (the web server) will close the socket.
You can check the format of request sent by you to the web server.