Forum > Networking and Web Programming

cannot receive messages; udp server with lnet

(1/44) > >>

prodingus:
Hi!

the client works just fine:


--- 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 test1;{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}{$APPTYPE CONSOLE}uses        sysutils, crt, lnet;var        Sock:TLUDP;begin            Sock:= TLUdp.Create(nil);    Sock.connect('1.1.1.2', 28);     repeat     Sock.sendmessage('ghj');    until false;  end.
on the "server" I use the hercules utility to see the data (and I see them just fine).

However, when using this code to make my version of server:


--- 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 test1;{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}{$APPTYPE CONSOLE}uses        sysutils, crt, lnet;var        Sock:TLUDP;        tmp: string;begin                Sock:= TLUdp.Create(nil);    //Sock.connect('1.1.1.2', 28);        Sock.listen(word('28'));     repeat begin    Sock.getmessage(tmp);    writeln(Sock.getmessage(tmp));     sleep(100);    end; until false;  end.
I get nothing. Can anyone provide a barebone "get udp message loop" example without classes, methods  and stuff?

derek.john.evans:
What is up wth this line?

--- 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";}};} ---Sock.listen(word('28'));
Check the examples folder for lnet. There is an example called: packages/lnet/examples/console/ludp/ludp.pp

prodingus:
I did. The "word('28')" works only that way as it throws "constant string", expected "word".

derek.john.evans:
Why not just put 28?

prodingus:
Stupid me, just 28 works! Still no received data from "server".

Navigation

[0] Message Index

[#] Next page

Go to full version