Daine Mamacos | 1 Jul 2010 23:08

uip on an x86

I've used uIP on a few micro's before, and wanted to port it to x86.
What I've done is just treat a raw socket as driver to ready bytes from.
That's all fine and dandy, however. When the buffer gets cast into an struct uip_eth_hdr *, I noticed that
because of 
the incorrect byte orders, the addresses (anything that uses 2 bytes) ends up in the wrong order. I see the
profuse use 
of HTONS etc all over the place, however it's not used during ip address comparison, and as such the ip's are
always in 
a reversed order ((168.192).(1.0)) if your ip address is 192.168.0.1.

Maybe I'm being plain stupid, but surely this is an absolutely critical place to use htons? Am I missing
something here?

Thanks
Daine.

invective2 | 2 Jul 2010 03:23
Picon

Multiple ports without protosockets

I have an application that doesn't use protothreads that can either listen for
a connection, and then handle all the receiving and transmitting, or it can
initiate a connection to a remote host, and handle everything. I need to be
able to do both at the same time: Listen for, and handle commands coming in on
one port, and connect to a different host on a different port at the same time.

Is this possible to do without protosockets? I can't figure out a way to change
the current connection, and the uip_send always just uses the current
connection.

Stefan Schake | 2 Jul 2010 07:48
Picon

Re: Multiple ports without protosockets

Hey,

you can't handle two different connections in the same appcall, thats
just a design limitation in uIP. You can however initiate new
connections at basically any time you wish, so just use the polling
appcalls for that. Also, make use of the application data that uIP
holds for each connection and store what you need there. This way, you
will be able to handle any number of connections. If the protocol is
the same in both cases, thats how I'd do it.

Also remember that protothreads can't do anything beyond the normal
API. They're really only a set of macros to make your life easier.
Greetings

2010/7/2  <invective2 <at> gmail.com>:
> I have an application that doesn't use protothreads that can either listen for
> a connection, and then handle all the receiving and transmitting, or it can
> initiate a connection to a remote host, and handle everything. I need to be
> able to do both at the same time: Listen for, and handle commands coming in on
> one port, and connect to a different host on a different port at the same time.
>
> Is this possible to do without protosockets? I can't figure out a way to change
> the current connection, and the uip_send always just uses the current
> connection.
>

invective2 | 2 Jul 2010 20:09
Picon

Re: Re: Multiple ports without protosockets

Thanks for the response. 

I am using TCP for both connections, so that should make things easier, I hope.

I understand what you are saying about handling one connection at a time in the
app call. That's what I'm confused about. Let's say I make a connection on some
port to a server, and then later connect to another server on another port. Now
when it comes time to send (using uip_send), or when I check for new data
(using uip_newdata()), how do I know which connection I am servicing, and which
server I am sending data to? And how do I switch between them? It's OK if I
have to switch back and forth, I don't need to multithread, I just can't figure
out how.

invective2 | 2 Jul 2010 21:41
Picon

Re: Re: Re: Multiple ports without protosockets

Alright, I just answered my own question. uIP already has the ability to handle
all my connections; what a groovy little stack! I didn't realize that the code
I was working from was already going through every connection each time the
timer expired. The stack is smarter than I had thought, or maybe I'm not as
smart as I think.

To Mr. Dunkels, and whomever else helped developed this stack: Good work!

Dave Festing | 4 Jul 2010 10:18
Picon
Favicon

Re: Re: Re: Re: Multiple ports without protosockets

I was interested in something similar and a search for <multiple applications>
on this site turned some helpful posts.

Good luck

lkumar | 4 Jul 2010 10:18
Picon
Favicon

Re: Re: Re: Re: Re: Multiple ports without protosockets

Esta conta foi desactivada. A sua mensagem foi redireccionada, em breve será contactado.

Se preferir poderá contactar-nos para o endereço geral <at> eneida.pt.

lkumar | 4 Jul 2010 10:19
Picon
Favicon

Re: Re: Re: Re: Re: Re: Multiple ports without protosockets

Esta conta foi desactivada. A sua mensagem foi redireccionada, em breve será contactado.

Se preferir poderá contactar-nos para o endereço geral <at> eneida.pt.

lkumar | 4 Jul 2010 10:19
Picon
Favicon

Re: Re: Re: Re: Re: Re: Re: Multiple ports without

Esta conta foi desactivada. A sua mensagem foi redireccionada, em breve será contactado.

Se preferir poderá contactar-nos para o endereço geral <at> eneida.pt.

lkumar | 4 Jul 2010 10:20
Picon
Favicon

Re: Re: Re: Re: Re: Re: Re: Re: Multiple ports without

Esta conta foi desactivada. A sua mensagem foi redireccionada, em breve será contactado.

Se preferir poderá contactar-nos para o endereço geral <at> eneida.pt.


Gmane