[En-Nut-Discussion] TCP connection to fixe IP

ennut at thezachariasgroup.com ennut at thezachariasgroup.com
Wed Oct 14 14:48:47 CEST 2009


   Gilles,
   Have you performed the ping test I requested?
   If the ping test doesn't work then the bridge 
is probably not configured properly.
What is the make and model of the bridge?

   Thanks!
     Zack


At 04:05 AM 10/14/2009, Gilles wrote:
>Sorry to confuse you but I have difficulties to explain exactly my problem.
>
>I send TCPIP frame to a distant PC.
>
>I use the code sent in my last email.
>
>The code work perfectly if the PC is in my local network.
>
>The code fail is I try to send to a distant PC.
>
>The PC is connect through a bridge that redirect fix IP to remote network.
>         -Fix IP is : 82.xxx.yyy.zzz
>         -remote network is : 192.168.1.23 (example)
>         -port is: 5001
>The bridge is configured to manage redirection between Fix IP et remote PC
>IP.
>
>My code try to send TCPIP frame from my ARM9 board to the distant PC.
>
>I hope this is clear for you now.
>Any idea?
>Gilles
>
>
>
>
>-----Original Message-----
>From: ennut at thezachariasgroup.com [mailto:ennut at thezachariasgroup.com]
>Sent: mardi 13 octobre 2009 16:51
>To: gilles at palmcom.fr; Ethernut User Chat (English); 'Ethernut User Chat
>(English)'
>Subject: Re: [En-Nut-Discussion] TCP connection to fixe IP
>
>    Gilles,
>    I'm a little confused where the 82.xx.yy.zz IP
>Address is coming from. It was not mentioned earlier.
>
>If you bring up a command prompt window on the distant PC and type
>ipconfig
>then hit the "Enter" key,
>
>What is displayed for all instances of:
>IP Address
>Subnet Mask and
>Default Gateway?
>
>
>If communication is to work, that distant PC had
>better have an IP Address starting with 82.
>If all of the addresses start with 192. then the
>distant PC is behind a router and
>unable to be accessed directly from the internet.
>
>Let me know what you find.
>
>
>There is something else to try. Can you ping the
>distant PC from a PC on the local network?
>  From a command prompt window on the local PC type:
>ping 82.xx.yy.zz
>then hit the "Enter" key.
>
>If the ping request times out from the local PC
>then there is no way your ARM9 board will be able to talk to the distant PC.
>
>
>    Regards!
>      Zack
>
>
>
>
>At 08:31 PM 10/12/2009, Gilles wrote:
> >Zack,
> >I agree on the local addresses compatibilities.
> >But for distant PC, I don't understand why it does not work.
> >
> >The code is :
> >
> >TCPSOCKET *sock1;
> >     FILE *stream1;
> >
> >             if ((sock1 = NutTcpCreateSocket()) != 0)
> >             {
> >                    if (NutTcpConnect(sock1,dest_addr, PortSend) == 0)
> >                    {
> >                     if ((stream1 = _fdopen((int) sock1, "r+b")) != 0)
> >                                         {
> >                                         fwrite(buff,1,i,stream1);
> >                                         fclose(stream1);
> >                                                 }
> >                            else
> >                                                 {
> >                                                         puts("Assigning a
> >stream failed");
> >                                                 }
> >                         }
> >                         else
> >                         {
> >                   int errorTCP;
> >                   errorTCP = NutTcpError(sock1);
> >                   printf("failed: 0x%x",errorTCP);
> >                    }
> >
> >                    NutTcpCloseSocket(sock1);
> >                 }
> >
> >Init Values are :
> >PortSend = 5001;
> >Dest_addr = 82.xx.yy.zz
> >bridge are OK is both directions on port 5001&5002
> >
> >This code work in local network.
> >I assume that it will work also to distant IP
> >So the faulty code is maybe in the initialisation of my IP stuff.
> >
> >Void InitEthernetDevice(void);
> >{
> >
> >     if (NutRegisterDevice(&DEV_ETHER, 0 , 0))
> >     {
> >         puts("No Ethernet Device");
> >         return -1;
> >     }
> >
> >     printf("\nConfigure %s...", DEV_ETHER_NAME);
> >
> >     NutNetLoadConfig("eth0");
> >
> >
> >     NutNetIfConfig(DEV_ETHER_NAME, confnet.cdn_mac, confnet.cdn_cip_addr,
> >confnet.cdn_ip_mask);
> >
> >
> >     if(confnet.cdn_gateway)
> >         {
> >         printf("\nAdd Gateway...");
> >         NutIpRouteAdd(0,0, confnet.cdn_gateway, &DEV_ETHER);
> >         }
> >     puts("\nOK");
> >
> >     return 0;
> >}
> >
> >The complete initialisation code is :
> >
> >     InitEthernetDevice();
> >     printf("Start Responder...");
> >     if (NutRegisterDiscovery((u_long)-1, 0, DISF_INITAL_ANN)) {
> >         puts("failed");
> >     }
> >     else {
> >         puts("OK");
> >     }
> >
> >
> >Any idea where to looking for?
> >Gilles
> >
> >
> >-----Original Message-----
> >From: ennut at thezachariasgroup.com [mailto:ennut at thezachariasgroup.com]
> >Sent: lundi 12 octobre 2009 23:48
> >To: gilles at palmcom.fr; Ethernut User Chat (English)
> >Subject: Re: [En-Nut-Discussion] TCP connection to fixe IP
> >
> >    Gilles,
> >    I see multiple problems.
> >1.) You will only have connectivity between
> >192.168.xxx.yyy addresses on a local network
> >because these are local IP addresses.
> >They will not go out of the local network onto
> >the internet with these 192.168 based addresses.
> >Your router will convert these 192.168 based IP addresses
> >to an IP Address and port number that is actually
> >accessible from the internet. The router won't
> >even try to convert a destination address
> >starting with 192.168 to an internet address.
> >
> >2.) Assuming the subnet mask is 255.255.255.0, your "not good" example
>shows
> >a
> >device IP of 192.168.1.1 with a gateway of
> >192.168.0.254. These are not compatible.
> >
> >To communicate with a distant PC, one of the
> >devices need to have a fixed IP Address that is not a local address.
> >The other unit then must connect to the PC with the fixed IP Address.
> >
> >    Zack
> >
> >
> >
> >At 05:12 PM 10/12/2009, you wrote:
> > >Bonjour Ole,
> > >
> > >1) As I said in my previous Email, the code works correctly in a local
> > >network BUT with respect of the IP range.
> > >Example:
> > >
> > >GOOD: device IP = 192.168.0.1     and   gateway IP = 192.168.0.254
> > >
> > >NOT GOOD : device IP = 192.168.1.1     and   gateway IP = 192.168.0.254
> > >
> > >In that case, the gateway IP is force to 0.0.0.0 by NutOS
> > >
> > >How can I bypass the 0.0.0.0 change ?
> > >
> > >2) I have redo some test between my ARM9 and a distant PC to be able to
> >give
> > >you more details about this type of connection. Actually, the error
> >received
> > >is : Time out
> > >Firewall have check and seems correct.
> > >No TCPIP message can be send out to an external IP
> > >
> > >Best regards
> > >Gilles
> > >
> > >-----Original Message-----
> > >From: Ole Reinhardt [mailto:ole.reinhardt at embedded-it.de]
> > >Sent: lundi 5 octobre 2009 09:55
> > >To: gilles at palmcom.fr; Ethernut User Chat (English)
> > >Subject: Re: [En-Nut-Discussion] TCP connection to fixe IP
> > >
> > >Hi Gilles,
> > >
> > > > I have developed a piece of code to establish a dialog between my ARM9
> > >board
> > > > and a PC in 2 different location.(2 different IP fix addresses)
> > > > When the PC establish the TCP link ,  the ARM9 receive and respond to
> >the
> > > > TCP frame correctly.
> > > > If I try to establish the TCP dialog starting from the ARM9, it fails
>on
> > >the
> > > > NutTcpConnect(sock1,dest_addr, PortSend)
> > > > All is good if I stay inside my office network.
> > >
> > >Are you sure there is neither a masquerading (NAT) nor any other kind of
> > >firewall between the pc and your board? Have you correctly set your
> > >gateways on both entities?
> > >
> > >Have you checked the error code after the failed connect with
> > >NutTcpError()? It might give you a hint what is going wrong.
> > >
> > >Regards,
> > >
> > >Ole Reinhardt
> > >
> > >--
> > >  _____________________________________________________________
> > >|                                                             |
> > >| Embedded-IT                                                 |
> > >|                                                             |
> > >| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
> > >| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
> > >| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
> > >| Germany              Web:         http://www.embedded-it.de |
> > >|_____________________________________________________________|
> > >
> > >
> > >_______________________________________________
> > >http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> >
> >
> >_______________________________________________
> >http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>_______________________________________________
>http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list