This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: synthetic target network support for UDP socket.
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Santoshkumar Zalake <santoshkumar dot zalake at wipro dot com>
- Cc: eCos Disuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 9 Mar 2005 15:40:25 +0100
- Subject: Re: [ECOS] synthetic target network support for UDP socket.
- References: <024201c524b1$c19bed40$5f6bc90a@EC4SEMI118507>
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