Recent

Author Topic: TCP IP CLient  (Read 7349 times)

DooMGuarD

  • New member
  • *
  • Posts: 8
TCP IP CLient
« on: May 04, 2010, 09:07:46 pm »
hi all

i ned to make a aplication for WinCE with a simple TCPIP Client, like a chat...

i try indy and lnet but in both have a error whe compile for wince...

please send me documentation and componet for work tcpip client under wince...

thanks

charles

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: TCP IP CLient
« Reply #1 on: July 16, 2010, 02:26:41 pm »
A little bit late, but tell me which compile error lnet has and then I can try to help.

tr_escape

  • Sr. Member
  • ****
  • Posts: 402
  • sector name toys | respect to spectre
    • Github:
Re: TCP IP CLient
« Reply #2 on: February 10, 2011, 01:29:05 pm »
It is working on windows 4.2




procedure TForm1.Button1Click(Sender: PObj);
var
 adr : TInetSockAddr;
 soc : Tsocket;
 buf : String[255];
 Sin,Sout : Text;
 i        : integer;

begin

 soc := fpsocket(AF_INET,SOCK_STREAM,IPPROTO_TCP);  //socket hazırlığı
 if soc=-1 then
 begin
 showmessage('Socket hatası');
 exit;
 end;

 adr.sin_family := AF_INET;                         //inet yapılandırılması
 adr.sin_port := htons(501);                        //hangi port?
 if srvip='' then
 adr.sin_addr := StrToNetAddr('192.168.1.5')        //bağlanılacak ip
 else adr.sin_addr := StrToNetAddr(srvip);

 if not  Connect (soc,adr,Sin,Sout) then
 begin
   ShowMessage('Bağlantı hatası : '+NetAddrToStr(adr.sin_addr));   //ip canlı değilse
   exit;
 end;

 buf := EditBox1.Text;
 Send(soc,buf,length(buf)+1,0);                     //gönderim adımı

 fpshutdown(soc,0);                                 //bağlantıyı kapat
 CloseSocket(soc);
 EditBox1.Text:= '';

end;