__socketFile is created by this method<div><div><br></div><div><div>def connect(hostName) :</div><div> import errno</div><div> global __connSocket</div><div> global __socketFile</div><div> __connSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)</div>
<div> __connSocket.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 0)</div><div> try:</div><div> ret = __connSocket.connect_ex((hostName, __connPort))</div><div> except:</div><div> ret = 101 # ENETUNREACH, Network is unreachable</div>
<div> if ret == 0:</div><div> __socketFile = __connSocket.makefile("r+", __socketBufSize)</div><div> return ret</div><br><div class="gmail_quote">On Fri, Mar 29, 2013 at 3:05 AM, Curt Hagenlocher <span dir="ltr"><<a href="mailto:curt@hagenlocher.org" target="_blank">curt@hagenlocher.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How was __socketFile created? Is there a possibility that it's looking for "\r\n" but only getting "\n"? (I can't remember anything about IronPython's handling of eol.)<br>
<br><div class="gmail_quote"><div><div class="h5">
On Thu, Mar 28, 2013 at 3:53 PM, Claudio C <span dir="ltr"><<a href="mailto:claudio@webshell.it" target="_blank">claudio@webshell.it</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
<div><div class="h5">
<div>Hello everybody,</div><div><br></div><div>I'm calling this method with IronPython but this never ends cause the second call to readline in the while loop never returns.</div><div><br></div><div>This doesn't happend with Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) </div>
<div>[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin</div><div><br></div><div>def __getServerReply() :</div><div> """ Internal routine. """</div><div> global __socketFile</div>
<div> lines = []</div><div> reply = __socketFile.readline(2048) </div><div> idx = reply.find(' ')</div><div> if idx < 0:</div><div> iReply = simwbConstants.NET_BADREPLYFORMAT</div><div> else:</div>
<div> iReply = int(reply[:idx])</div><div> if iReply == simwbConstants.NET_REPLY_EMPTY:</div><div> return (iReply,[])</div><div> if iReply == simwbConstants.NET_REPLY_ASCII:</div><div> llen = 1</div>
<div> while llen > 0 : </div><div> l = __socketFile.readline(__socketBufSize).rstrip(' \n')</div><div> llen = len(l)</div><div> if llen > 0:</div><div> lines.append(l)</div>
<div> print 'added....'</div><div><br></div><div> return (iReply,lines) </div><div><br></div><div> return (iReply,[])</div><div><br></div><div>Does anyone know how to fix it?</div>
<div>
Many thanks</div>
<br></div></div>_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org" target="_blank">Ironpython-users@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div></div>