SocketApp: Using inputbuffer within the loop() function

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

Re: SocketApp: Using inputbuffer within the loop() function

Postby GregEigsti » Sat Oct 09, 2010 2:38 am

Don't use s->inputbuffer to receive data - its only 20 bytes; use your own buffer and pass in its (larger) size to PSOCK_INIT (or make the s->inputbuffer larger - it lives in socketapp.h). Or better yet don't use PSOCK_INIT at all unless you really need it (see the uIP reference docs) and reference uip_appdata directly.
Code: Select all
// a new global
#define RECVBUFFSIZE 200
char recvBuff[RECVBUFFSIZE];

//in socketapp.c -> socket_app_appcall()
  /*
   * If a new connection was just established, we should initialize
   * the protosocket in our applications' state structure.
   */
  if(uip_connected()) {
    PSOCK_INIT(&s->p, recvBuff, sizeof(recvBuff));
  }
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: SocketApp: Using inputbuffer within the loop() function

Postby GregEigsti » Sat Oct 09, 2010 2:40 am

I highly recommend reading the uIP stack docs for tweaking your app's behavior like this.

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

Previous

Return to Sketches and Applications

Who is online

Users browsing this forum: Google [Bot] and 1 guest