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]

synthetic target network support for UDP socket.


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.

Please let me any one come across theses errors and if possible related
solution.

Thanks in Advance,
Z.Santosh..

----------------------------------------------------------------------------
----------------------
Re: synthetic target network support
From: Andrew Lunn <andrew dot lunn at ascom dot ch>
To: Sam Sortais <sams at myself dot com>
Cc: ecos-discuss at sources dot redhat dot com
Date: Tue, 5 Feb 2002 09:05:21 +0100
Subject: Re: [ECOS] synthetic target network support
References: <20020204233944.7514.qmail@iname.com>



On Tue, Feb 05, 2002 at 07:39:44AM +0800, Sam Sortais wrote:

> I am trying myself to use socketcall() found in syscall table to
> have two synthetic targets talk together via socket.  This would be
> great as this would allows simulation of different target running
> eCos on one single linux host and possibly mixing with some real
> eCos target :-)
> Did anybody already tried that ? Any advice or special trap to avoid ?

Yep, we have done that, using Unix domain sockets.

Don't us blocking system calls.

This subject has been discussed a few times in the past. Look back in
the archive for other tips.

    Andrew
----------------------------------------------------------------------------
-----
References:
Re: synthetic target network support
From: Sam Sortais
Index Nav:[Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav:[Date Prev] [Date Next][Thread Prev] [Thread Next]




-- 
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]