This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: synthetic target network support for UDP socket.


On Wed, Mar 09, 2005 at 07:40:32PM +0530, Santoshkumar Zalake wrote:
> Hi All,
> 
> According following mail, I used "socketcall" function calls to use Linux
> (native) socket function. These are working fine TCP (stream) socket. But
> these calls are not properly working for UDP (datagram) sockets.
> I used following code to establish socket connection between to process
> using synthetic eCos-2.0.
> 
> /* To get socket  */
> 
> unsigned long sock_info[10];
> int udp_socket_fd, socket_error,a=1;
> 
> memset(sock_info,0x00,10*sizeof(unsigned long));
> 
> socket_info[0] = (unsigned long) AF_INET;
> socket_info[1] = (unsigned long) SOCK_DGRAM;
> socket_info[2] = (unsigned long)0;
> 
>  udp_socket_fd = cyg_hal_sys_socketcall(SYS_SOCKET,socket_info);
> 
> if(udp_socket_fd <0)
> {
>             printf("Error Socket %d", udp_socket_fd);
>             exit(0);
> }
> /* To set Reuse */
> memset(sock_info,0x00,10*sizeof(unsigned long));
> 
> socket_info[0] = (unsigned long)udp_socket_fd;
> socket_info[1] = (unsigned long) SOL_SOCKET;
> socket_info[2] = (unsigned long) SO_REUSEADDR;
> socket_info[3] = (unsigned long)(&a);
> socket_info[4] = (unsigned long)(sizeof(int));
> 
> socket_error = cyg_hal_sys_socketcall(SYS_SETSOCKOPT,socket_info);
> 
> if(socket_error <0)
> {
>             printf("ERROR SetSockOpt %d", socket_error);
> }
> 
> 
> In this code, I am getting socket(udp_socket_fd )value as 4 or 5. But I am
> getting socket_error value as -92 (according error.h this error is
> ENOPROTOOPT which means protocol not available) in setsockopt functionality.

What value are you using for SOL_SOCKET? 0xffff or 1?

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]