WiShield/uIP streaming server?

Questions specifically related to the TCP/IP stack that interfaces with the driver.

WiShield/uIP streaming server?

Postby GregEigsti » Sat Oct 03, 2009 12:54 am

In reference to fdarvas' question in the following thread
http://asynclabs.com/forums/viewtopic.php?f=15&t=18&start=20

fdarvas would like to create a WiShield app that that opens a socket that essentially streams sensor data via that socket to a remote client. In looking at the sample apps I am seeing that they are "hit and run" - meaning that the server apps will listen on a port and either send one chunk of data and close the socket or only send data in response to received data. After reviewing the uIP documents my understanding is that data can only be transmitted in response to the stack calling your UIP_APPCALL function - and the recommended way to accomplish this is via paying attention to uip_poll() (or its variants). My experimentation shows this to be true (I cannot send using uip_send() from my application loop() but can uip_send() in response to a poll event in UIP_APPCALL).

From the uIP doc
1.6.1.8 Polling
...
The polling event has two purposes.
...
The other purpose is to let the application send new data that has been produced. The application can only send data when
invoked by uIP, and therefore the poll event is the only way to send data on an otherwise idle connection.


Am I understanding correctly that an app that wants to stream data over a socket must queue up its data and send it in response to a poll (or other) UIP_APPCALL event?

Also, how does breemen's distribution of his Client/Server code (from above thread) differ from the official WiShield distribution? It appears to be a superset with some added functionality?

Thanks!
Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiShield/uIP streaming server?

Postby GregEigsti » Sat Oct 03, 2009 9:23 am

After thinking about it and re-reading some uIP stuff I think my above thinking is correct re: having to send from UIP_APPCALL.

One other question - is UIP_APPCALL called down the stack from WiFi.run() (and not due to an ISR)? Was thinking that I would have to protect any shared data but if the UIP_APPCALL is called due to the call to WiFi.run() this would not be an issue (at least for my code that would update the shared data via a call from loop()).

Thanks!
Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiShield/uIP streaming server?

Postby GregEigsti » Sat Oct 03, 2009 3:07 pm

So I have been playing with this and have an implementation that sends a buffer full o' bytes every UIP_APPCALL/uip_poll(). I have also found that the max amount of bytes that I can send is ~330, I can only send once per UIP_APPCALL/uip_poll() and UIP_APPCALL/uip_poll() is called about every 500ms. So this means that the max number of bytes that I am able to stream is 330 per 500ms period or 660 per second.

What am I missing to get more data (magnitudes) streamed via the WiShield?

[Edit]
It looks like I can squeeze more out by sending additional bytes in response to uip_acked(). Yuck, means more complicated send buffer handling...
Any better ideas?

Thanks!
Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiShield/uIP streaming server?

Postby fdarvas » Sat Oct 03, 2009 9:47 pm

Where (in relation to loop()) are these functions called?

In the example, everything is in socketapp.c, but can this moved to the main program? Or how do I pass data, e.g. from a buffer, to these uip functions???
fdarvas
 
Posts: 29
Joined: Wed Sep 16, 2009 9:44 pm
Location: Seattle

Re: WiShield/uIP streaming server?

Postby Tamalpias » Wed Jan 06, 2010 8:31 pm

I just ran into the same issue while venturing on my own implementation. Have you ever been able to get more continuous data sent over a live socket stream? Thanks!
Tamalpias
 
Posts: 3
Joined: Sun Dec 20, 2009 10:28 am

Re: WiShield/uIP streaming server?

Postby GregEigsti » Mon Jan 11, 2010 9:30 pm

Umm, I don't remember, maybe ;) PM me with your email addr and I'll send you what I was playing with.

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiShield/uIP streaming server?

Postby rryan » Thu Sep 23, 2010 12:37 pm

Greg:

After reading the zg2100 driver, it looks like the send buffer size is bounded by UIP_BUFSIZE. Did you try increasing UIP_CONF_BUFSIZE to see if that helps in sending packets > ~330 bytes?
rryan
 
Posts: 5
Joined: Tue Sep 21, 2010 11:57 pm

Re: WiShield/uIP streaming server?

Postby GregEigsti » Sun Sep 26, 2010 9:19 pm

I have brought a lot of the uIP stack settings from various files into apps-conf.h in the user contrib distribution of the WiShield libs to provide a better "one stop shopping" experience - doing the same for UIP_BUFSIZE/UIP_CONF_BUFSIZE would certainly be beneficial (until people start blowing their stacks...). I think I have mucked with the buff size setting in the past but have never launched into a streaming type app personally (its a 16mhz Arduino after all). My comments in this thread were merely trying to help others out - not my project :lol:

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiShield/uIP streaming server?

Postby spidermonkey04 » Tue Sep 28, 2010 10:33 am

I regularly use an 800 byte buffer, gone up over 1000 at times...

---Jared
spidermonkey04
 
Posts: 66
Joined: Thu Oct 29, 2009 6:45 pm


Return to TCP/IP Stack

Who is online

Users browsing this forum: No registered users and 1 guest