<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I have used both first and second step requested (i.e. {send_timeout,0} and erlang:port_command(Socket,Data)) but these methods also returns the same. Returns OK while tcp packets has not been delivered(i.e. TCP ack not received). The packet is pushed into the queue and trying to send. So i want an async send mechanism to check whether the  packet has been sent to receiver. If packet delivered means just returns ok otherwise will return {error,timeout}<div><br></div><div>Thanks,</div><div>Vinoth Kumar J<br><div><div><div><hr id="stopSpelling">Date: Mon, 17 Mar 2014 12:53:41 +0400<br>Subject: Re: [erlang-questions] gen_tcp send non-blocking in erlang?<br>From: max.lapshin@gmail.com<br>To: vinothsparrow@live.com<br>CC: erlang-questions@erlang.org<br><br><div dir="ltr"><div class="ecxgmail_extra">It is a very, very dangerous practice, because you loose control over your program with non-blocking send.</div><div class="ecxgmail_extra"><br></div><div class="ecxgmail_extra">First step that you MUST do is setting send_timeout on socket. By default it is infinity and it means that your process may get blocked forever trying to push data.</div>
<div class="ecxgmail_extra"><br></div><div class="ecxgmail_extra">I don't know why infinity is a default value, it is really strange for me.</div><div class="ecxgmail_extra"><br></div><div class="ecxgmail_extra">Second, dangerous step is just using port_command(Socket, IoData). Then you must wait for messages from this socket. But don't use it =)</div>
<div class="ecxgmail_extra"><br></div></div></div></div></div></div>                                    </div></body>
</html>