[En-Nut-Discussion] Problem to connect a tcp socket

Harald Kipp harald.kipp at egnite.de
Wed Jul 20 11:48:00 CEST 2005


Julien,

No idea why the connect fails. I'd suggest to check this
with Ethereal.

But I can answer the question about port numbers. The
TCPSOCKET structure stores these values in network
byte order, not in host byte order. You should use
ntohs() to convert them. Beside that I'd use %u instead
of %d.

Harald

At 09:58 20.07.2005 +0200, you wrote:
>Hello everybody,
>the problem i have is i can't connect a TCP socket to a server (who 
>works). I use an example, of the ethernut software manual 2.3, page39 "a 
>simple tcp client looks likethis:..." .
>The NutTcpConnect() function return -1 and i really don't understand why.
>The several printf show correct ip address (local & remote), but the local 
>port number is 272 (i don't know why) and the remote port number is -28241 
>nevertheless i set the remote port number to 5010 with the NutTcpConnect() 
>function!! The NutTcpError() function returns the value 10064 --> "host is 
>down".
>I don't know what to do. If anyone have an idea?
>Thank you.




More information about the En-Nut-Discussion mailing list