Connect to another aplication via TCP/UDP lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- M[a]nny · 2011-07-21 09:20 Hello! I'd like to make application which is able to connect via TCP or UDP to another one. I'm not sure how to do this but i can make it in PHP. The application is Counter-Strike 2D dedicated server. Look at this. This function execute command. It doesn't return anything. Code: PHP  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function send_command($ip,$port,$rcon,$command) {        $fp = @fsockopen("udp://".$ip, $port, $errno, $errstr);        if ($fp){              $request = chr(1).chr(0).chr(242).chr(strlen($rcon)).$rcon. pack("S",strlen($command)).$command;                fwrite($fp, $request);        }}  But this one returns some value (for example list of players etc..). Code: PHP  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function send_command_rtn($ip,$port,$rcon,$command) {        $fp = @fsockopen("udp://".$ip, $port, $errno, $errstr);        if ($fp){              $request = chr(1).chr(0).chr(242).chr(strlen($rcon)).$rcon. pack("S",strlen($command)).$command;                fwrite($fp, $request);                $ausgabe = fread($fp, 1000);                return $ausgabe;        }} What should i do to make this in Lazarus? Any ideas would be really appreciated! ---------------------------------------------------------------------- WalterK · 2011-07-21 13:57 I'm not sure if this is what you're looking for, but there are two small example programs in the rtl documentation under the Connect and fpAccept entries; search for sockcli.pp and socksvr.pp.  The rtl pdf is here: ftp://ftp.freepascal.org/pub/fpc/docs-pdf/rtl.pdf ---------------------------------------------------------------------- Leledumbo · 2011-07-31 07:23 FPC has basic units for this with sockets unit. However, it's much easier to use 3rd party libraries like synapse or lnet. For games, it's better to use lnet because it has full asynchronous connection support.