Changeset 79

Show
Ignore:
Timestamp:
12/07/07 19:05:21 (12 months ago)
Author:
follower
Message:

Add routine to read and match bytes received. (Essentially strcmp replacement without requiring a large receive buffer.) Note that failed matches drop any bytes matched successfully.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde

    r78 r79  
    198198  recv(testSocket, &theByte, 1); 
    199199  return theByte; 
     200} 
     201 
     202 
     203int readMatch(char *stringToMatch) { 
     204       
     205  while (getSn_RX_RSR(testSocket) < strlen(stringToMatch)) { 
     206     // block 
     207     // TODO: Return error or wait or "too short"? 
     208  } 
     209 
     210  for (int currCharIdx = 0; currCharIdx < strlen(stringToMatch); currCharIdx++) { 
     211    if (readByte() != stringToMatch[currCharIdx]) { 
     212       return 0; 
     213    } 
     214  } 
     215   
     216  return 1; 
    200217} 
    201218