Unix Programming - sendto:: Invalid argument.

This is Interesting: Free IT 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, 7:33 am


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

sendto:: Invalid argument.

DaVinci

2006-09-21, 7:33 am


DaVinci wrote:
> #define PORT 2223
> why htonl(PORT) will make sendto()
> if(sendto(sockfd,buff3,10,0,
> (struct sockaddr*)&sad,sizeof(sad))<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






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com