Sending/receiving data to a TCP/IP port on localhost lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- mikea105 · 2016-02-12 04:48 I'm a total noob at communications programming, and now I need to talk to a server on a port on the local computer. I've looked at the tools such as Synapse, Ararat Synapse and so forth.  Unfortunately, even looking at the wiki for Synapse, I can't figure out where to start.  I see sample code, but it's using SMTP or HTTP.  What I need to do is send and receive binary data to a server (it's an AGWPE server, if that helps) on a particular port on the same computer.  The server is well documented, but I have absolutely no idea how to actually get the data to/from the port. Does anyone out there have any sample code or can point me at some code where this sort of thing is done so I can at least get started?  Also, if you have any suggestions as how to format the binary data, that would be helpful.  Thanks in advance to anyone who can help! ---------------------------------------------------------------------- Thaddy · 2016-02-12 06:58 Well the protocols you mention are actually on top of TCP/IP, so for example this code should work: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program socksend;{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}{$APPTYPE CONSOLE}uses  SynaFpc,SynSock,BlckSock;var  Sock:TBlockSocket;begin  Sock := TBlockSocket.Create;  try    Sock.Connect('LOCALHOST','8080');    Sock.SendString('Testme!');// You want to use SendStream or SendStreamRaw for binary.  finally    Writeln(Sock.GetErrorDescEx);  Sock.Free;  end;  Readln;end.  The receive side is similar in that you would use BlockSocket directly instead of one of the higher protocols. ---------------------------------------------------------------------- mikea105 · 2016-02-16 20:47 Thank you very much!  Your answer makes perfect sense.  Now I see what I was doing wrong.  Now I can get that working!