<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<br>Hi,<br><br>Try using ethernet2 library, if you are not already using it. <br><br>Src : http://jpmens.net/2009/04/24/arduino-ethernet2-library/<br><br>Regards,<br>Shinoj.<br><br><br><br><div><div id="SkyDrivePlaceholder"></div>> From: icanprogram-sKcZck+fQKg@public.gmane.org<br>> To: tlug-lxSQFCZeNF4@public.gmane.org<br>> Subject: Re: [TLUG]: help with Arduino TCP/IP connect problem<br>> Date: Thu, 28 Jun 2012 15:43:04 -0400<br>> <br>> That command was very helpful.   It indicated that others were attempting to <br>> connect to this port (I have a posting on the Arduino forum).    When we get <br>> a successful Arduino connect we see the ESTABLISHED state on the netstat <br>> output.<br>> <br>> We have added 2 more tests to the matrix.<br>> <br>> i) we put a loop around the connect to count the number of timeout/retries<br>> ii) we brought down Apache on the Linode and put our custom daemon up on port <br>> 80<br>> <br>> On the port 80 test (ii above) the Arduino was able to connect each and every <br>> time without timeouts.   ie. we got exactly the same behavior with our custom <br>> daemon as we did with Apache.<br>> <br>> On the retry test (i above) we got a very strange but reproducible pattern.<br>> <br>> after cold boot - success on 3rd retry<br>> after 1st reset - success on 4th retry<br>> after 2nd reset - success on 5th retry<br>> etc.<br>> <br>> (all this is documented at <br>> http://www.icanprogram.com/opndrs/arduino/connectproblem.html)<br>> <br>> Huh???<br>> <br>> I'm completely baffled.    Our testing matrix is pointing to a very obtuse bug <br>> in the Arduino library in which the connect behavior changes if the port <br>> number moves from 80 -> 8000.    Our Linux stub test verifies that the Linode <br>> port 8000 is open and accessable from the network node where the Arduino <br>> resides.<br>> <br>> Any ideas to add to our test matrix?    The posting to the Arduino forum has <br>> thus far failed to produce even a single response even though I've updated <br>> the thread continuously with each test result.<br>> <br>> Thanks in advance for your help.<br>> <br>> bob<br>> <br>> <br>> On Thursday 28 June 2012 01:40 am, Shinoj VG wrote:<br>> > Hi,<br>> ><br>> > When the connection fails, please do a netstat -an | grep 8000 and report<br>> > back on the status of connection as seen from linode end. Is there<br>> > something similar you can do to find the connection status on Arduino? If<br>> > yes, this will be helpful in debugging. My guess at this point is that this<br>> > is something to do with the client side rather than the server.<br>> ><br>> > Regards,<br>> > Shinoj.<br>> ><br>> > > From: icanprogram-sKcZck+fQKg@public.gmane.org<br>> > > To: tlug-lxSQFCZeNF4@public.gmane.org<br>> > > Subject: Re: [TLUG]: help with Arduino TCP/IP connect problem<br>> > > Date: Wed, 27 Jun 2012 14:42:31 -0400<br>> > ><br>> > > Great suggestion.    I've managed to get this done now.   The results are<br>> > > posted at:<br>> > ><br>> > > http://www.icanprogram.com/opndrs/arduino/connectproblem.html<br>> > ><br>> > > We ran 3 tests all from same network node:<br>> > ><br>> > > i) Arduino -> Linode:8000<br>> > > ii) Arduino -> Linode:80 (exactly same code as i) with only port number<br>> > > switched)<br>> > > iii) Linux stub -> Linode:8000<br>> > ><br>> > > In all cases the packet sequence and timing seems to be virtually<br>> > > identical.<br>> > ><br>> > > The Linux stub test always succeeds.   The Arduino -> Linode:80 always<br>> > > succeeds.    The Arduino->Linode:8000 almost never succeeds and appears<br>> > > to timeout in two distinct ways:<br>> > ><br>> > > a) no TCP/IP packets make their way to the Linode at all<br>> > > b) correct sequence of TCP/IP packets appears to be exchanged but Arduino<br>> > > times out anyway<br>> > ><br>> > > Any suggestions?<br>> > ><br>> > > Thanks in advance.<br>> > ><br>> > > bob<br>> > ><br>> > > On Monday 25 June 2012 05:49 am, Shinoj VG wrote:<br>> > > > Try doing a packet capture using tcpdump on linode and see if you<br>> > > > notice any difference between the handshake happening for port80 and<br>> > > > custom server when you try to connect from arduino.<br>> > > ><br>> > > > Regards,<br>> > > > Shinoj.<br>> > > ><br>> > > > > From: icanprogram-sKcZck+fQKg@public.gmane.org<br>> > > > > To: tlug-lxSQFCZeNF4@public.gmane.org<br>> > > > > Subject: [TLUG]: help with Arduino TCP/IP connect problem<br>> > > > > Date: Thu, 21 Jun 2012 13:04:57 -0400<br>> > > > ><br>> > > > > We are having a lot of problems debugging a TCP/IP connect problem<br>> > > > > between my associate's Arduino and my Linode server app.    The gist<br>> > > > > of the problem is described here:<br>> > > > ><br>> > > > > http://www.icanprogram.com/opndrs/arduino<br>> > > > ><br>> > > > > It would appear that the chip used to handle the TCP/IP stack on the<br>> > > > > Arduino thinks that the socket connection it establishes (as a<br>> > > > > client) has not succeeded and it times out.    However, on the Linode<br>> > > > > side we observe that the socket connection has succeeded (ie. been<br>> > > > > accepted) because we get our child process spawned.   Furthermore if<br>> > > > > we use the Linux C client we never observe a client socket timeout<br>> > > > > from my associates node.<br>> > > > ><br>> > > > > The server code is listed in the link above, and uses a traditional<br>> > > > > accept connection -> fork child handler approach.   The child process<br>> > > > > immediately closes the duplicated parent listener socket.   The<br>> > > > > parent process immediately closes the duplicated accepted socket file<br>> > > > > descriptor.<br>> > > > ><br>> > > > > From my travels in Google land it appears that there is a 3 way hand<br>> > > > > shake involving SYN and ACK TCP/IP packets which are exchanged to<br>> > > > > consumate a socket connection.    I'm guessing these are the messages<br>> > > > > that the Arduino Wiznet w5100 chip is missing.   I certainly don't<br>> > > > > know how to control this level from my high level C library.<br>> > > > ><br>> > > > > Interestingly if the Arduino is instructed to connect to the port 80<br>> > > > > on my Linode it succeeds in that connect almost 100% of the time<br>> > > > > whereas the connections to my custom server fails more than 90% of<br>> > > > > the time.<br>> > > > ><br>> > > > > I'd love to hear some thoughts on how we might go about debugging<br>> > > > > this problem.    If you know of any Arduino developers out there, <br>> > > > > we'd love to have more eyeballs on this problem.<br>> > > > ><br>> > > > > Thanks in advance for your help.<br>> > > > ><br>> > > > > bob<br>> > > > > --<br>> > > > > The Toronto Linux Users Group.      Meetings: http://gtalug.org/<br>> > > > > TLUG requests: Linux topics, No HTML, wrap text below 80 columns<br>> > > > > How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists<br>> > ><br>> > > --<br>> > > The Toronto Linux Users Group.      Meetings: http://gtalug.org/<br>> > > TLUG requests: Linux topics, No HTML, wrap text below 80 columns<br>> > > How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists<br>> --<br>> The Toronto Linux Users Group.      Meetings: http://gtalug.org/<br>> TLUG requests: Linux topics, No HTML, wrap text below 80 columns<br>> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists<br></div>                                      </div></body>
</html>