Socket not closing (after a day of working)

I’m using DynC 10.60 on BL4S110. The partial piece of code below seems to work fine for over a day of communications, where &sock23 should get a request between 1 and 6 times an hour…

When the socket doesn’t complete, I need a way to clear it… Should I place a sock_abort() at the end of the costate block to be sure the socket is clear. OR Is there a IFCONFIG command set that can reset the port?

The data is not as critical as having new &sock23 transactions processed without doing a power reset to clear it.

Thanks in advance for any help.
Bob


costate
{
// checks the telNet socket (PORT = 23) for any changes
tcp_listen(&sock23,23,0,0,NULL,0);
while (!sock_established(&sock23) && sock_bytesready(&sock23)==-1)
{
   tcp_tick(NULL);
   yield;
}
do {
          bytes_read=sock_fastread(&sock23,buffer,sizeof(buffer)-1);
          if(bytes_read>0)
          {
              buffer[bytes_read]=0; 
              // store value into a brdat[] array from input 
              if (strncmp(buffer, "u", 1)==0 && strlen(buffer)>3)   	      
              {
                    update_parse(buffer, brdat, 0);
              }
              // else if ( 8 more else ifs with similar conditions )
              // {
              //      Other similar routines ();
              //  }   
              sock_write(&sock23,buffer,bytes_read);
          }
      } while(tcp_tick(&sock23));
 }