Forum > Networking and Web Programming

Easiest way to send UDP packets

(1/4) > >>

Hi there,
I'm looking for an easy approach to send out UDP packets from an Windows application.

First I tried to get ICS9.1 working, but I didn't manage to import it into Lazarus. Seems like the file-extensions in the "Installer" dir are not compatible with Lazarus.

Then I saw that there's a ready to install version of Indy10 in the Online package installer. So I installed it.
What I'm now missing, is a hint about "how to start". The Indy-site and various resources seem to be offline meanwhile.
Has anyone a hint for me? Thanks!

Indy sockets with demos, you can find in github :
You can search the internet to find tutos.

You can look at this page for downloading chm manual :

Marco van de Voort wrote there a tutorial how-to modify ICS to work with FPC... back in 2005 :D
Since I never tested it with FPC (FPC got already a lot of goodies included) I can't tell if its still like that.

Berkley Sockets in unit Sockets. It's a C API so a bit cumbersome, so I've written a small wrapper using some FPC native types (like strings, records, etc.):

See examples/udpclient:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program udpclient; {$mode objfpc}{$H+} uses  SimpleSockets; var  Sock: TSocket;  Msg: TReceiveFromStringMessage;begin  Sock := UDPSocket(stIPv4);  try    SendStrTo(Sock, '', 1337, 'Hello UDP');    Msg := ReceiveStrFrom(Sock);    WriteLn('Server at ', Msg.FromAddr.Address, ':', Msg.FromPort, ' answered: ', Msg.Data);  finally    CloseSocket(Sock);  end;  ReadLn;end.

Curt Carpenter:
I use the TLUDP component from LNet (OPM).


[0] Message Index

[#] Next page

Go to full version