How to create a TCP socket for android? lazarus / 43-Android ---------------------------------------------------------------------- Jonathan · 2012-02-10 07:35 I try to create a tcp socket using the lnet's TLTCP, but it doesn't work I use the newest android lcl example from felipemdc. add some code in the Button1Click   (define a selfSocket within the Form's private ) ... address := '192.168.1.7'; port := 40100; selfSocket := TLTCP.Create(nil); if selfSocket.Connect(address,port) then  ...... ---------------------------------------------------------------------- fastblade · 2012-02-12 13:13 haven't test the lnet, but add following code to the button1click, it works Code: [Select]selfsocket := fpSocket(AF_INET,SOCK_STREAM,IPPROTO_IP);   if selfsocket = -1 then    begin     Application.OnMessageDialogFinished := @HandleMessageDialogFinished;     Application.MessageBox('SOCKET ERROR', 'Title', MB_ABORTRETRYIGNORE);    end else    begin     ProgressBar1.Position := ProgressBar1.Position + 10;     saddr.sin_family := AF_INET;     saddr.sin_port := htons(4001);     sAddr.sin_addr.s_addr := HostToNet((192 shl 24) or (168 shl 16) or (1 shl 8) or 7);     if fpConnect(selfSocket,@saddr,SizeOf(TSockAddr)) <> 0 then      begin       ProgressBar1.Position := ProgressBar1.Position + 50;      end else      begin       fpShutDown(selfSocket,2);      end;    end; If want those code work, must modify the AndroidManifest.xml, add line: Don't forget to setup your emulator's network proxy (-proxy) on command line startup