PSOCK_READTO problem

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

PSOCK_READTO problem

Postby Pure-Gold » Fri Aug 27, 2010 2:57 am

I wrote a small app for iPhone that sends int that contains 3 bytes of values 0x00-0xFF to control RGB LED.
My problem is that I use the scale of 0-255 and if I use PSOCK_READTO(&s->p,'\0'); it sometimes not working well
if one of the first values is 0.
How can I overcome this problem ?

Thanks.
Pure-Gold
 
Posts: 1
Joined: Fri Apr 23, 2010 4:48 am

Re: PSOCK_READTO problem

Postby GregEigsti » Fri Aug 27, 2010 7:35 am

Take a look at PSOCK_READBUF which reads until it fills a buffer (in your case 3 bytes). Or you could ditch the PSOCK_ stuff all together and use the "lower level" uIP APIs to read the incoming data. The PSOCK_ stuff is useful if you need to do multiple socket actions (say read and write) per invocation of your UIP_APPCALL function - otherwise the "lower level" uip_ functions generally serve you better.

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


Return to TCP/IP Stack

Who is online

Users browsing this forum: No registered users and 1 guest