<p dir="ltr">Switching between packet formats *is* possible (we do it sometimes) *but* you should be aware of interactions with the 'active' socket option.<br>
That is,<br>
- don't use active=true when doing this. Race conditions!<br>
- active=once can be used, but should be off at the point where you change packetization.<br>
- Finally, for good measure, don't change 'packet' and 'active' in the same setopts call.</p>
<p dir="ltr">/Erik</p>
<div class="gmail_quote">Den 04/03/2015 16.45 skrev "Pedro Marques da Silva" <<a href="mailto:posilva@gmail.com">posilva@gmail.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>I have looked before I post the question and is not clear why this will happen.</div><div><br></div><div>Maybe is not possible to switch from {packet,0} to {packet,4} after receiving data on a socket!</div><div><br></div><div>Best</div><div><br></div><div>pms</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div>--<br>Pedro Marques da Silva<br>---------------------------------------------------<br>E-mail Pessoal : <a href="mailto:posilva@gmail.com" target="_blank">posilva@gmail.com</a><br>---------------------------------------------------</div></div>
<br><div class="gmail_quote">2015-03-04 11:25 GMT+00:00 Rad Gruchalski <span dir="ltr"><<a href="mailto:radek@gruchalski.com" target="_blank">radek@gruchalski.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Hi Pedro,</div><div><br></div><div>You should have a look at inet:setopts</div><div><a href="http://www.erlang.org/doc/man/inet.html#setopts-2" target="_blank">http://www.erlang.org/doc/man/inet.html#setopts-2</a></div><div>
<p style="font-family:Helvetica;font-size:10pt;margin-bottom:0cm">
</p><p style="font-family:Helvetica;font-size:10pt;margin-bottom:0cm">
</p><p style="margin-bottom:0cm">
</p><p style="margin-bottom:0cm"><font color="#000000"><font face="Helvetica, sans-serif"><font style="font-size:9pt">Kind
regards,
<br>Radek
Gruchalski<br>
</font></font></font><font face="Helvetica, sans-serif"><font style="font-size:9pt"><a href="mailto:radek@gruchalski.com" target="_blank">radek@gruchalski.com</a><a href="mailto:radek@gruchalski.com" target="_blank">
</a></font></font><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size:9pt"><br></font></font></font><a href="http://de.linkedin.com/in/radgruchalski/" target="_blank"><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size:9pt">de.linkedin.com/in/radgruchalski/</font></font></font></a><font color="#000000"><font face="Helvetica, sans-serif"><font style="font-size:9pt"><br><br></font></font></font><font color="#878787"><font face="Helvetica, sans-serif"><font style="font-size:8pt"><b>Confidentiality:<br></b></font></font></font><font color="#878787"><font face="Helvetica, sans-serif"><font style="font-size:8pt">This
communication is intended for the above-named person and may be
confidential and/or legally privileged.<br>If it has come to you in
error you must take no action based on it, nor must you copy or show
it to anyone; please delete/destroy and inform the sender
immediately.</font></font></font></p></div><div><div>
<p style="color:#a0a0a8">On Wednesday, 4 March 2015 at 01:48, Pedro Marques da Silva wrote:</p>
</div></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
<span><div><div><div><div><div dir="ltr">Hi Erlangers,<div><br></div><div>I am doing a server to serve a flash application. When a flash client establish a connection(tcp socket) it sends a policy request (xml format message) and the server must reply with a policy file (xml file). After this exchange the client can connect to the socket as a regular connection.</div><div><br></div><div><br></div><div>When I accept the connection the socket have a {packet,0} option set and checks if is a policy request and sends the policy file back. After this I change the option to {packet,4} but I do not receive anymore data. If I stay with {packet,0} I will receive the binary data sent by the client</div><div><br></div><div><br></div><div>Any one knows about any problem with changing socket options after receive some data?</div><div><br></div><div>thanks<br clear="all"><div><div>--<br>Pedro Marques da Silva<br>---------------------------------------------------<br>E-mail Pessoal : <a href="mailto:posilva@gmail.com" target="_blank">posilva@gmail.com</a><br>---------------------------------------------------</div></div>
</div></div>
</div></div></div><div><div>_______________________________________________</div><div>erlang-questions mailing list</div><div><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a></div><div><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>
</blockquote></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>