help with Arduino TCP/IP connect problem

bob 295 icanprogram-sKcZck+fQKg at public.gmane.org
Thu Jun 28 19:43:04 UTC 2012


That command was very helpful.   It indicated that others were attempting to 
connect to this port (I have a posting on the Arduino forum).    When we get 
a successful Arduino connect we see the ESTABLISHED state on the netstat 
output.

We have added 2 more tests to the matrix.

i) we put a loop around the connect to count the number of timeout/retries
ii) we brought down Apache on the Linode and put our custom daemon up on port 
80

On the port 80 test (ii above) the Arduino was able to connect each and every 
time without timeouts.   ie. we got exactly the same behavior with our custom 
daemon as we did with Apache.

On the retry test (i above) we got a very strange but reproducible pattern.

after cold boot - success on 3rd retry
after 1st reset - success on 4th retry
after 2nd reset - success on 5th retry
etc.

(all this is documented at 
http://www.icanprogram.com/opndrs/arduino/connectproblem.html)

Huh???

I'm completely baffled.    Our testing matrix is pointing to a very obtuse bug 
in the Arduino library in which the connect behavior changes if the port 
number moves from 80 -> 8000.    Our Linux stub test verifies that the Linode 
port 8000 is open and accessable from the network node where the Arduino 
resides.

Any ideas to add to our test matrix?    The posting to the Arduino forum has 
thus far failed to produce even a single response even though I've updated 
the thread continuously with each test result.

Thanks in advance for your help.

bob


On Thursday 28 June 2012 01:40 am, Shinoj VG wrote:
> Hi,
>
> When the connection fails, please do a netstat -an | grep 8000 and report
> back on the status of connection as seen from linode end. Is there
> something similar you can do to find the connection status on Arduino? If
> yes, this will be helpful in debugging. My guess at this point is that this
> is something to do with the client side rather than the server.
>
> Regards,
> Shinoj.
>
> > From: icanprogram-sKcZck+fQKg at public.gmane.org
> > To: tlug-lxSQFCZeNF4 at public.gmane.org
> > Subject: Re: [TLUG]: help with Arduino TCP/IP connect problem
> > Date: Wed, 27 Jun 2012 14:42:31 -0400
> >
> > Great suggestion.    I've managed to get this done now.   The results are
> > posted at:
> >
> > http://www.icanprogram.com/opndrs/arduino/connectproblem.html
> >
> > We ran 3 tests all from same network node:
> >
> > i) Arduino -> Linode:8000
> > ii) Arduino -> Linode:80 (exactly same code as i) with only port number
> > switched)
> > iii) Linux stub -> Linode:8000
> >
> > In all cases the packet sequence and timing seems to be virtually
> > identical.
> >
> > The Linux stub test always succeeds.   The Arduino -> Linode:80 always
> > succeeds.    The Arduino->Linode:8000 almost never succeeds and appears
> > to timeout in two distinct ways:
> >
> > a) no TCP/IP packets make their way to the Linode at all
> > b) correct sequence of TCP/IP packets appears to be exchanged but Arduino
> > times out anyway
> >
> > Any suggestions?
> >
> > Thanks in advance.
> >
> > bob
> >
> > On Monday 25 June 2012 05:49 am, Shinoj VG wrote:
> > > Try doing a packet capture using tcpdump on linode and see if you
> > > notice any difference between the handshake happening for port80 and
> > > custom server when you try to connect from arduino.
> > >
> > > Regards,
> > > Shinoj.
> > >
> > > > From: icanprogram-sKcZck+fQKg at public.gmane.org
> > > > To: tlug-lxSQFCZeNF4 at public.gmane.org
> > > > Subject: [TLUG]: help with Arduino TCP/IP connect problem
> > > > Date: Thu, 21 Jun 2012 13:04:57 -0400
> > > >
> > > > We are having a lot of problems debugging a TCP/IP connect problem
> > > > between my associate's Arduino and my Linode server app.    The gist
> > > > of the problem is described here:
> > > >
> > > > http://www.icanprogram.com/opndrs/arduino
> > > >
> > > > It would appear that the chip used to handle the TCP/IP stack on the
> > > > Arduino thinks that the socket connection it establishes (as a
> > > > client) has not succeeded and it times out.    However, on the Linode
> > > > side we observe that the socket connection has succeeded (ie. been
> > > > accepted) because we get our child process spawned.   Furthermore if
> > > > we use the Linux C client we never observe a client socket timeout
> > > > from my associates node.
> > > >
> > > > The server code is listed in the link above, and uses a traditional
> > > > accept connection -> fork child handler approach.   The child process
> > > > immediately closes the duplicated parent listener socket.   The
> > > > parent process immediately closes the duplicated accepted socket file
> > > > descriptor.
> > > >
> > > > From my travels in Google land it appears that there is a 3 way hand
> > > > shake involving SYN and ACK TCP/IP packets which are exchanged to
> > > > consumate a socket connection.    I'm guessing these are the messages
> > > > that the Arduino Wiznet w5100 chip is missing.   I certainly don't
> > > > know how to control this level from my high level C library.
> > > >
> > > > Interestingly if the Arduino is instructed to connect to the port 80
> > > > on my Linode it succeeds in that connect almost 100% of the time
> > > > whereas the connections to my custom server fails more than 90% of
> > > > the time.
> > > >
> > > > I'd love to hear some thoughts on how we might go about debugging
> > > > this problem.    If you know of any Arduino developers out there, 
> > > > we'd love to have more eyeballs on this problem.
> > > >
> > > > Thanks in advance for your help.
> > > >
> > > > bob
> > > > --
> > > > The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> > > > TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> > > > How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
> >
> > --
> > The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> > TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> > How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list