title: make tcp server socket class for android with Delphi Xe5
body: <p>project files on: <a href="https://drive.google.com/file/d/0BxODt2IJsmR8cUQ4cVltbWFzYUk/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0BxODt2IJsmR8cUQ4cVltbWFzYUk/edit?usp=sharing</a>
  here is the my running codes</p>
  
  <pre><code>    ...........
  try
  soket1:=TJServerSoket.JavaClass.init((8090));
  //adres:=soket1.iNetAdres.ip;
  memo1.Lines.Add('Port: '+inttostr(soket1.Port));
  except
    on E:Exception do memo1.Lines.Add('Port Açılamadı: '+E.Message);
  end;
  try
    memo1.Lines.Add('ip: '+jstringtostring((soket1.iNetAdres.Host)));
  except
    on E:Exception do memo1.Lines.Add('ip bigisi alınamadı: '+E.Message);
  
  end;
  .............
  
  ............
  
  try
    soketC:=soket1.accept;
    //o1.writeChars(stringtojstring('merhaba'));
    memo1.Lines.Add('accept' );
  except
    on E:Exception do memo1.Lines.Add('accept Hata: '+E.Message);
  
  end;
  
  ....................
  
  try
  
  
    //i1:=soketC.getInputStream;
    memo1.Lines.Add('i1: '+inttostr(soketC.getInputStream.read) );
    //memo1.Lines.Add('i1: '+jstringtostring(soketC.getInputStream.readUTF) );
  except
    on E:Exception do memo1.Lines.Add('i1 Hata: '+E.Message);
  end;
  
  try
    //o1:=TJoutStream.JavaClass.init(soketC.getOutputStream);
    //o1.writeChars(stringtojstring('merhaba') );
    soketC.getOutputStream.write(65);
    memo1.Lines.Add('o1: merhaba' );
  except
    on E:Exception do memo1.Lines.Add('o1 Hata: '+E.Message);
  end;
  
  //soketC.getOutputStream.close;
  //soketC.getInputStream.close;
  //soketC.close;
  </code></pre>
  
  <p>please help...
  i'm trying "write" / "read" (inputstream/outputstream) to socket but i get error...</p>
  
  <p>here is the my bad socket (socket' "s" ) api:</p>
  
  <pre><code>.............
  .............
  
    ////////////////////////////soket/////////////////////////////
  
  
    [javaSignature('java/net/InetAddress')]
    JAdres=interface(JObject)
    ['{7A525333-38BC-4D2A-8160-D164D1CAA30E}']
      function getHostName:Jstring;cdecl;
  
      property Host:Jstring read getHostName;
  
    end;
  
    JAdresClass=interface(JObjectClass)
    ['{B34C47C9-7FC8-4120-B087-60F517A9323D}']
  
    end;
  
    TJAdres = class(TJavaGenericImport&lt;JAdresClass, JAdres&gt;) end;
  
  
   ////////////////out buffer////////////////////
   ///
  
       [javaSignature('java/io/OutputStream')]
    Jout=interface(jobject)
      ['{AC9EEC99-FF3A-46E4-AFC3-C4D3309D8C8E}']
      //procedure bind(localAddr:integer);cdecl;//overload;
      //property Port: Integer read getLocalPort;
      procedure write(buffer:array of integer;offset,count:integer);cdecl;overload;
      procedure write(buffer:array of integer);cdecl;overload;
      procedure write(buffer:integer);cdecl;overload; //tek bit yaz
      //procedure writeChars(str:jstring);cdecl;
      procedure close;cdecl;
      procedure flush;cdecl;
    end;
    JoutClass = interface(JObjectClass)
      ['{46FBBEEE-22C7-45EA-BED3-A41BED01E500}']
      procedure init(); cdecl;//Deprecated
      end;
  
    TJout = class(TJavaGenericImport&lt;JoutClass, Jout&gt;) end;
  
   ////////////////////////////////////////////////
  
      [javaSignature('java/io/ObjectOutputStream')]
    JoutStream=interface(jobject)
      ['{A6421CC3-B76C-4124-AB2E-AEE0C4749E71}']
      //procedure bind(localAddr:integer);cdecl;//overload;
      //property Port: Integer read getLocalPort;
      procedure write(buffer:array of integer;offset,count:integer);cdecl;overload;
      procedure write(buffer:array of integer);cdecl;overload;
      procedure write(buffer:integer);cdecl;overload; //tek bit yaz
      procedure writeChars(str:jstring);cdecl;
      procedure close;cdecl;
      procedure flush;cdecl;
    end;
    JoutStreamClass = interface(JObjectClass)
      ['{83D69F8F-8833-4EF5-B00D-2EA45F58AC46}']
      function init(obj:Jout):JoutStream; cdecl;overload;//Deprecated
      end;
  
    TJoutStream = class(TJavaGenericImport&lt;JoutStreamClass, JoutStream&gt;) end;
    ///////////////////////input buffer/////////////////
  
         [javaSignature('java/io/InputStream')]
    Jin=interface(jobject)
     ['{42549EE4-B69C-4491-BEC1-5626C4E7D717}']
      //procedure bind(localAddr:integer);cdecl;//overload;
      //property Port: Integer read getLocalPort;
      function read(buffer:array of jbyte;offset,count:integer):integer;cdecl;overload;
      function read(buffer:array of jbyte):integer;cdecl;overload;
      function read():integer;cdecl;overload; //tek bit yaz
      //function readUTF():jstring;cdecl;
      procedure close;cdecl;
      procedure reset;cdecl;
    end;
    JinClass = interface(JObjectClass)
      ['{AA965CF8-ED96-4EFE-B5F3-B02DAEDA8979}']
      function init():Jin; cdecl;overload;//Deprecated
      //procedure init(); cdecl;overload;
      end;
  
    TJin = class(TJavaGenericImport&lt;JinClass, Jin&gt;) end;
    /////////////////////////////////////////////////////
       [javaSignature('java/io/ObjectInputStream')]
    JinStream=interface(jobject)
     ['{839ACAEC-229A-4261-88B4-136173B6FCBF}']
      //procedure bind(localAddr:integer);cdecl;//overload;
      //property Port: Integer read getLocalPort;
      function read(buffer:array of jbyte;offset,count:integer):integer;cdecl;overload;
      function read(buffer:array of jbyte):integer;cdecl;overload;
      function read():integer;cdecl;overload; //tek bit yaz
      function readUTF():jstring;cdecl;
      procedure close;cdecl;
      procedure reset;cdecl;
    end;
    JinStreamClass = interface(JObjectClass)
      ['{27B4071A-5BC8-4594-A701-DBB92DBEE45A}']
      procedure init(); cdecl;overload; Deprecated;
      //procedure init(); cdecl;overload;
      end;
  
    TJinStream = class(TJavaGenericImport&lt;JinStreamClass, JinStream&gt;) end;
  
  
  
  
   ////////////////client socket////////////////////
    [javaSignature('java/net/Socket')]
    JSoket=interface(jobject)
     ['{3120C92A-DA6B-4584-B6FB-DEDEB36CA6FB}']
        procedure close;cdecl;
        function getOutputStream:Jout;cdecl;
        function getInputStream:Jin;cdecl;
  
  
    end;
  
      JSoketClass = interface(JObjectClass)
      ['{F1C713D1-9A17-48EF-BD98-60FD859A2B3E}']
      function init:JSoket; //cdecl;overload;//Deprecated
    end;
  
    TJSoket = class(TJavaGenericImport&lt;JSoketClass, JSoket&gt;) end;
  
  ///
  
    [javaSignature('java/net/ServerSocket')]
    JServerSoket=interface(jobject)
      ['{FB896B05-0F70-4BF7-A69D-4655D173A303}']
      function getLocalPort:integer;cdecl;//overload;
      procedure bind(localAddr:integer);cdecl;//overload;
      procedure close;cdecl;//overload;
      function getInetAddress:JAdres;cdecl;
      function accept():JSoket;cdecl;
  
      property Port: Integer read getLocalPort;
      property iNetAdres: JAdres read getInetAddress;
      //function getLocalPort: Integer; cdecl;
      //procedure ServerSocket(port:integer);cdecl;
  
    end;
  
      JServerSoketClass = interface(JObjectClass)
      ['{5D578C73-1315-4143-B14C-8E26BC1975BC}']
      function init(port:integer):JServerSoket; //cdecl;overload;//Deprecated
    end;
  
    TJServerSoket = class(TJavaGenericImport&lt;JServerSoketClass, JServerSoket&gt;) end;
  
  ..........
  </code></pre>