For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2006 > sendto:: Invalid argument.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sendto:: Invalid argument.
DaVinci

2006-09-21, 4:01 am


#define PORT 2223
why htonl(PORT) will make sendto()
if(sendto(sockfd,buff3,10,0,
(struct sockaddr*)&,sizeof())<0)
error,but htons(PORTPort) will not ?
the error is :

sendto:: Invalid argument.

DaVinci

2006-09-21, 4:01 am


DaVinci wrote:
> #define PORT 2223
> why htonl(PORT) will make sendto()
> if(sendto(sockfd,buff3,10,0,
> (struct sockaddr*)&,sizeof())<0)
> error,but htons(PORTPort) will not ?
> the error is :
>
> sendto:: Invalid argument.

I am sorry to touble all of your.
Maybe I know the answer now,
The Port is 16bit.
so htons() is right choice.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com