Forum > Networking and Web Programming

cannot receive messages; udp server with lnet

<< < (2/44) > >>

dje:
The ludp example works fine. Your code fails here for a few reasons. The port number 28 returns Permission denied. I used 1234 with ludp and it worked.

Also, the example uses the callback OnReceive to handle listening events.

As a tip. Always start with a working example and then hack it to suit your requirements.

MarkMLl:

--- Quote from: prodingus on July 01, 2022, 02:01:32 am ---Stupid me, just 28 works! Still no received data from "server".

--- End quote ---

Look, if you'd told us in the first place what OS, version of the compiler etc. you'd got you'd have made it a damn sight easier for everybody.

You can't use ports <1024 (or maybe <=, can't remember) on a unix-like OS including Linux without having root privilege. Not sure whether there's a corresponding restriction on Windows etc.

MarkMLl

prodingus:
Sorry for the missing info: the testing is done on 2 win7 sp1 x64 lite vms, lazarus 1.6, FPC 3.0, SVN 51630.


--- Quote ---Your code fails here for a few reasons. The port number 28 returns Permission denied. I used 1234 with ludp and it worked.
--- End quote ---

Before switching to lnet, I was testing with BlckSock (synapse?). I was still using port 28 on both vms and it I was sending and receiving just fine.


--- Quote ---Also, the example uses the callback OnReceive to handle listening events.
--- End quote ---
I don't work with classes and methods... I don't know how to use it.

prodingus:
Ps, changing port number, still no receive.

Remy Lebeau:

--- Quote from: prodingus on July 01, 2022, 01:04:42 am ---
--- 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";}};} ---repeat begin  Sock.getmessage(tmp);  writeln(Sock.getmessage(tmp));   sleep(100);end; until false;
--- End quote ---

Why are you calling getmessage() twice per loop iteration?  Get rid of the 1st one.  Or, use the OnReceive event, like Derek suggested.


--- Quote from: MarkMLl on July 01, 2022, 09:19:49 am ---You can't use ports <1024 (or maybe <=, can't remember) on a unix-like OS including Linux without having root privilege. Not sure whether there's a corresponding restriction on Windows etc.

--- End quote ---

There is no such restriction on Windows.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version