urbiClearConnection

PURPOSE ^

Flush the connection coming from the server

SYNOPSIS ^

function urbiClearConnection(con,silence)

DESCRIPTION ^

Flush the connection coming from the server
 This function clears all the data coming from the server contained in 
 the input buffer in order to get a clean entry for the next messages. 
 This is useful if something went wrong with binary data input for
 example.

 The function outputs the result to screen if there is only one argument

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function urbiClearConnection(con,silence) 
0002 %Flush the connection coming from the server
0003 % This function clears all the data coming from the server contained in
0004 % the input buffer in order to get a clean entry for the next messages.
0005 % This is useful if something went wrong with binary data input for
0006 % example.
0007 %
0008 % The function outputs the result to screen if there is only one argument
0009 
0010 if (nargin <1)
0011     error('urbiClearConnection(con,silence)\n con : connection to urbi server\n silence : output to screen if absent',1);
0012 end
0013 
0014 % Clear lines by lines
0015 r = pnet(con, 'readline', 'noblock');
0016 while ~isempty(r)
0017     if (nargin == 1)
0018      disp(r);
0019     end
0020     r = pnet(con, 'readline', 'noblock');
0021 end;
0022 
0023 % Finish the work char by char
0024 r = pnet(con, 'read',1,'char', 'noblock');
0025 R = [];
0026 while ~isempty(r)
0027     if (nargin == 1)
0028      R = [R r];
0029     end
0030 r = pnet(con, 'read',1,'char', 'noblock');
0031 end;
0032 
0033 if (nargin == 1)
0034      disp(R);
0035 end

Generated on Tue 20-Dec-2005 19:05:34 by m2html © 2003