public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] networking on eCos
@ 2005-10-29  9:50 gerardo.rossi
  2005-10-30 18:55 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: gerardo.rossi @ 2005-10-29  9:50 UTC (permalink / raw)
  To: ecos-discuss; +Cc: mirkomassi

Hello there,
again that 2 italian students  with some problems about eCos...

We have 2 applications that use sockets, 1 transmitter that runs on eCos
transmitting data on port 2000 and 1 receiver(non-eCos application) that reads
data on the same port(all that on localhost momentarily).

1) Using the function gethostbyname() we have our error-message:

"Unable to find host 127.0.0.1" but we resolve this introducing
"init_all_network_interfaces()" and setting CYGDAT_NS_DNS_DEFAULT_SERVER via
configtool with our dns-ip, but this function is so slow and we try to use
"cyg_dns_res_init(struct in_addr *dns_server)".
Can you help we about what we have to pass to this function? Which are the
field-types of this structure?
...
hp=(struct hostent *)gethostbyname(cyg_hal_sys_argv[1]);
...

2) Another problem: the transmitter sends data without errors but the receiver
receives nothing and blocks on recv():
...
while (1) {
  n = recv(sock, buf, RTPSIZE, 0);
  ...
}
We preput that without eCos the applications communicate correctly.
What may be the cause?

3) For last(please!)

The full set of arguments can be accessed through the variables cyg_hal_sys_argc
and cyg_hal_sys_argv, but which function we have to pass them? Which header we
have to include? And how we have to pass our arguments to the application?

Thanks a lot and excuse to us for our bad english.

  Mirko, Gerardo.












----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] networking on eCos
  2005-10-29  9:50 [ECOS] networking on eCos gerardo.rossi
@ 2005-10-30 18:55 ` Andrew Lunn
  2005-10-31  8:25   ` David N. Welton
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2005-10-30 18:55 UTC (permalink / raw)
  To: gerardo.rossi; +Cc: ecos-discuss, mirkomassi

On Sat, Oct 29, 2005 at 11:46:42AM +0200, gerardo.rossi@studenti.univr.it wrote:
> Hello there,
> again that 2 italian students  with some problems about eCos...
> 
> We have 2 applications that use sockets, 1 transmitter that runs on
> eCos transmitting data on port 2000 and 1 receiver(non-eCos
> application) that reads data on the same port(all that on localhost
> momentarily).


OK. First off i suggest you visit the library and find a book on
TCP/IP socket programs. Your questions 


Next, you have a misunderstanding about what localhost is.  127.0.0.1
is local to the current TCP/IP stack. On your setup you have two
stacks running. You have the stack in eCos and the stack in
Linux. These have different localhosts. So anything you send to
localhost in eCos will only be received by socket code listening in
eCos. Anything you send to localhost in your Linux host will only be
received by socket code on that linux host. You cannot do any
communication between an eCos program and Linux programs this way.

To get eCos and Linux talking to each other you have to use proper IP
addresses. You should take a look at this URL which talked about the
synthetic ethernet driver:

http://ecos.sourceware.org/docs-latest/ref/devs-eth-synth-ecosynth.html

and

http://ecos.sourceware.org/docs-latest/ref/hal-synth-arch.html

which talked about the synthetic target in general...

> 1) Using the function gethostbyname() we have our error-message:
> 
> "Unable to find host 127.0.0.1" but we resolve this introducing
> "init_all_network_interfaces()" and setting CYGDAT_NS_DNS_DEFAULT_SERVER via
> configtool with our dns-ip, but this function is so slow and we try to use
> "cyg_dns_res_init(struct in_addr *dns_server)".
> Can you help we about what we have to pass to this function? Which are the
> field-types of this structure?

You don't normally pass dot addresses to gethostby name. It will
probably work, but it is better to use inet_aton().

Next, you say it is talking a long time. This probably indicates it is
not even talking to your DNS server. Once you get eCos's network
working using the synthetic ethernet driver i expect this will execute
much faster.

> ...
> hp=(struct hostent *)gethostbyname(cyg_hal_sys_argv[1]);
> ...

> 3) For last(please!)
> 

> The full set of arguments can be accessed through the variables
> cyg_hal_sys_argc and cyg_hal_sys_argv, but which function we have to
> pass them? Which header we have to include? And how we have to pass
> our arguments to the application?  Thanks a lot and excuse to us for
> our bad english.

cyg_hal_sys_argc is just like argc of main(). cyg_hal_sys_argv is just
like argv of main(). Just like any ANSI program.

To uses these variables you should include <cyg/hal/hal_io.h>.

        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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] networking on eCos
  2005-10-30 18:55 ` Andrew Lunn
@ 2005-10-31  8:25   ` David N. Welton
  0 siblings, 0 replies; 5+ messages in thread
From: David N. Welton @ 2005-10-31  8:25 UTC (permalink / raw)
  To: ecos-discuss; +Cc: gerardo.rossi, mirkomassi

Andrew Lunn wrote:
> On Sat, Oct 29, 2005 at 11:46:42AM +0200, gerardo.rossi@studenti.univr.it wrote:
> 
>>Hello there,
>>again that 2 italian students  with some problems about eCos...
>>
>>We have 2 applications that use sockets, 1 transmitter that runs on
>>eCos transmitting data on port 2000 and 1 receiver(non-eCos
>>application) that reads data on the same port(all that on localhost
>>momentarily).
> 
> 
> 
> OK. First off i suggest you visit the library and find a book on
> TCP/IP socket programs. Your questions 

This is pretty good too, although the Stevens books are a great resource
to have as well:

http://www.gnu.org/software/libc/manual/html_node/Sockets.html#Sockets

Saluti,
-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] networking on eCos
  2005-10-31 17:32 gerardo.rossi
@ 2005-10-31 18:32 ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2005-10-31 18:32 UTC (permalink / raw)
  To: gerardo.rossi; +Cc: ecos-discuss, mirkomassi

On Mon, Oct 31, 2005 at 06:28:55PM +0100, gerardo.rossi@studenti.univr.it wrote:
> >So anything you send to localhost in eCos will only be received by socket code
> >listening in eCos.
> 

> Now we have both applications that run on eCos-synth, the
> transmitter sends UDP packets correctly after a good connect() using
> a proper IP address like 142.31.248.70 .
> 
> The receiver have 2 different behaviors :
> 1) using IP like 127.0.0.1 it executes bind() between socket and address
> correctly, but the function init_all_network_interfaces() prints the following
> message: BOOTP/DHCP failed on eth0; and the recv() doesn't receive nothing.
>
> Can we configure manually via configtool the addresses, instead to use dhcp or
> bootp ?

Yes.

Disable CYGHWR_NET_DRIVER_ETH0_BOOTP. 
Enable  CYGHWR_NET_DRIVER_ETH0_ADDRS

and set CYGHWR_NET_DRIVER_ETH0_ADDRS_IP,
CYGHWR_NET_DRIVER_ETH0_ADDRS_NETMASK,
CYGHWR_NET_DRIVER_ETH0_ADDRS_BROADCAST,
CYGHWR_NET_DRIVER_ETH0_ADDRS_GATEWAY

> 2) using proper IP address the bind() fails and the output is:
> BOOTP/DHCP failed on eth0
> Bind error: Can't assign requested address
> 

> If we try to use I/O auxiliary when we start applications using the
>  --io option
> appears the following message: Error: unable to find the I/O
> auxiliary program on the current search PATH : please install the
> appropriate host-side tools.
> 
> But the eCos host-side was already compiled, what means this message?

It means it cannot find it. You need something like /opt/ecos/bin/ on
your path and you need the ethernet code in
/opt/ecos/libexec/ecos/devs/eth/synth/ecosynth/current/. Also rawether
should be set uid root.


        Andew

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS] networking on eCos
@ 2005-10-31 17:32 gerardo.rossi
  2005-10-31 18:32 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: gerardo.rossi @ 2005-10-31 17:32 UTC (permalink / raw)
  To: ecos-discuss; +Cc: mirkomassi

>So anything you send to localhost in eCos will only be received by socket code
>listening in eCos.

Now we have both applications that run on eCos-synth, the transmitter sends UDP
packets correctly after a good connect() using a proper IP address like
142.31.248.70 .

The receiver have 2 different behaviors :
1) using IP like 127.0.0.1 it executes bind() between socket and address
correctly, but the function init_all_network_interfaces() prints the following
message: BOOTP/DHCP failed on eth0; and the recv() doesn't receive nothing.

Can we configure manually via configtool the addresses, instead to use dhcp or
bootp ?

2) using proper IP address the bind() fails and the output is:
BOOTP/DHCP failed on eth0
Bind error: Can't assign requested address

If we try to use I/O auxiliary when we start applications using the --io option
appears the following message:
Error: unable to find the I/O auxiliary program on the current search PATH
     : please install the appropriate host-side tools.

But the eCos host-side was already compiled, what means this message?





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-31 18:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-29  9:50 [ECOS] networking on eCos gerardo.rossi
2005-10-30 18:55 ` Andrew Lunn
2005-10-31  8:25   ` David N. Welton
2005-10-31 17:32 gerardo.rossi
2005-10-31 18:32 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).