Changeset 103

Show
Ignore:
Timestamp:
12/10/07 05:29:28 (13 months ago)
Author:
follower
Message:

Change 'listen' methods to take a 'uint16_t'. Temporarily include a test socket creation--THIS BREAKS the webserver demo. NOTE/TODO: Supplying port numbers greater than 255 IS BROKEN--I don't know why--see comments for more details.

Files:
1 modified

Legend:

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

    r102 r103  
    224224 
    225225  public: 
    226     NetworkConnection(uint8_t port); // TODO: Add UDP, TCP choice? 
     226    NetworkConnection(uint16_t port); // TODO: Add UDP, TCP choice? 
    227227 
    228228    void listen(); // TODO: Return a useful value? 
     
    234234}; 
    235235 
    236 NetworkConnection::NetworkConnection(uint8_t port) { 
     236NetworkConnection::NetworkConnection(uint16_t port) { 
    237237  /* 
    238238 
     
    266266    NetworkInterface(Wiz810MjDevice& networkDevice); 
    267267     
    268     NetworkConnection listen(uint8_t port); 
     268    NetworkConnection listen(uint16_t port); 
    269269 
    270270    Wiz810MjDevice& device; // TODO: Make this a generic "network device" interface 
     
    293293}; 
    294294 
    295 NetworkConnection NetworkInterface::listen(uint8_t port) { 
     295NetworkConnection NetworkInterface::listen(uint16_t port) { 
    296296   /* 
    297297   
     298   
     299      NOTE: For reasons I don't understand, this FAILS TO WORK if port >255. 
     300            The port that gets opened is ~(port mod 255) but if you limit 
     301            port to be uint8_t for example you don't get an error until 
     302            the port number is bigger than 'long'. 
     303             
     304      TODO: Track and fix this for port numbers > 255. 
     305       
     306       
    298307   
    299308      Returns a NetworkConnection listening on the specified TCP port. 
     
    342351   
    343352  Serial.println("Setup exit..."); 
    344    
     353 
     354/**/ 
     355  Serial.println("Test sockets..."); 
     356 
     357  NetworkConnection conn = Network.listen(7); 
     358 
     359  Serial.println("Waiting for connection..."); 
     360 
     361  while (!conn.isConnected()) { 
     362    //Serial.print(!conn.isConnected()); 
     363    delay(500);  
     364  } 
     365   
     366  Serial.println("Connected..."); 
     367   
     368 
     369  Serial.println("End test and dummy loop"); 
     370  while (1) {}   
     371/**/ 
    345372} 
    346373