[En-Nut-Discussion] Newbie question: TCP Client

Guborev Sergei dezzer at nm.ru
Thu Oct 27 13:31:32 CEST 2005


Hello Nuts!

I'm currently working on simple TCP client application and it seemed to be very tricky problem for me.
I have dedicated IP address, remote server and ... Ethernut board, of course ( OS version 3.9.8 ).
When I implemented TCP server on Ethernut it was totally ok. Connections, sending data, all were good. But when I try to use board as client, i.e. connect to remote host it's usually failed with "Host is down" or "Operation timed out" error. But host is definitly working. Other devices has no problem to communicate with it. These are some parts of my code:

#define MASK "255.255.255.0"
#define MY_IP x.x.x.x
#define MY_GATE x.x.x.x
#define REMOTE_HOST x.x.x.x
#define MY_MAC ...

NutRegisterDevice(&devDebug0, 0, 0);
...    
NutRegisterDevice(&DEV_ETHER, 0x8300, 0);
NutNetIfConfig( "eth0", MY_MAC, inet_addr( MY_IP ), inet_addr( MASK ) );
NutIpRouteAdd( 0, 0, inet_addr( MY_GATE ), &DEV_ETHER);

sock = NutTcpCreateSocket();
    
NutTcpConnect( sock, inet_addr( REMOTE_HOST ), port );

Any suggestions? 
                With best regards, Sergei



More information about the En-Nut-Discussion mailing list