
Lib_binsock
       :
-  (/)
- /   
- InputStream (Resource)

---


   :


=> procedure debug_register(idx:integer);

  ,   
   (  )     
(Exception).





=> procedure enable_debug(flag:integer);

/  .
flag = 1 - 
flag = -1 - 
   .

  ,     
 -,    , :

[]
//sender -   ,    debug_register
//exception -    
//errstr -   (   )
//code -   (   )
procedure onerror(sender:Integer;exception:string;errstr:string;code:integer);
// ,        !
begin
 cmOK:=CreateCommand('OK',CM_OK,1);
 ShowAlert('Error #'+IntegerToString(code),'Exception: '+exception+chr(10)+chr(13)+'ErrorString: '+errstr, LoadImage('/icon.png'),ALERT_ERROR);
 delay(20000);
 ShowForm;
end;
[]

 code    :

 int ERR_OPENERROR  = 0; -   
 int ERR_CLOSEERROR = 1; -   
 int ERR_AVAILERROR = 2; -     
 int ERR_READERROR  = 3; -   
 int ERR_WRITEERROR = 4; -   
 int ERR_FLUSHERROR = 5; -   

!
 ,   ,    ,
     ;   ,  
 .





=> function open(url:string):integer;

    url.
 url :
socket://url:port

 1   ,   -1      
 ERR_OPENERROR.





=> procedure close;

 .
         ERR_CLOSEERROR.





=> function available:integer;

     .
    -1        ERR_AVAILERROR.





=> function read_byte:integer;

      ,     -1  
      ERR_READERROR.





=> function write_byte(data:integer):integer;

     data.
 1   ,   -1    ERR_WRITEERROR.





=> function get_in_stream:resource;

  resource  .





=> function write_bin(data:string):integer;

   data   .
 1   ,   -1    ERR_WRITEERROR.





=> function read_bin(len:integer):string;

     .
    null      ERR_READERROR.





=> function rx_count:integer;

   .





=> function tx_count:integer;

   . 





=> function flush:integer;

[ >= 1.1]

     

 1   ,   -1        
ERR_FLUSHERROR.





!
    


    Example
(  Motorola L9)


---

by ViNT
