Recent

Author Topic: reliable udp example  (Read 5068 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
reliable udp example
« on: January 17, 2019, 02:09:50 pm »
Hi, for my cross-platform project i search a rudp library for lazarus. Any suggestion?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: reliable udp example
« Reply #1 on: January 17, 2019, 02:44:07 pm »
Call me old fashioned but reliable UDP is called TCP.....<grin>
Although in most countries the current connections are so stable it doesn't really matter.

You may want to read this: https://en.wikipedia.org/wiki/User_Datagram_Protocol

Most sockets libraries have good UDP support. So anything will do....
Remember: UDP is a fire and forget weapon.....
« Last Edit: January 17, 2019, 02:49:45 pm by Thaddy »
Specialize a type, not a var.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: reliable udp example
« Reply #2 on: January 17, 2019, 02:59:11 pm »
Yes, I think so, but I was told that RUDP is more powerful than TCP in terms of speed.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

correa.elias

  • New Member
  • *
  • Posts: 18
Re: reliable udp example
« Reply #3 on: January 17, 2019, 03:39:38 pm »
Theres Enet (http://enet.bespin.org/) its used in games like this: http://sauerbraten.org/
Its a C library that can be compiled to a DLL (or SO or Dylib) and used by freepascal.
The bindings for this library are included by default in fpc (look into FPC_FOLDER/packages/libenet/examples).

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: reliable udp example
« Reply #4 on: January 17, 2019, 03:52:57 pm »
The bindings for this library are included by default in fpc (look into FPC_FOLDER/packages/libenet/examples).

They're not present in FPC 3.0.4 for Windows.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: reliable udp example
« Reply #5 on: January 17, 2019, 03:58:35 pm »
Theres Enet (http://enet.bespin.org/) its used in games like this: http://sauerbraten.org/
Its a C library that can be compiled to a DLL (or SO or Dylib) and used by freepascal.
The bindings for this library are included by default in fpc (look into FPC_FOLDER/packages/libenet/examples).
Yes, but when i build exaxmples return this

Code: Pascal  [Select][+][-]
  1. Compile Project, Target: serverapp: Exit code 256, Errors: 3, Hints: 2
  2. serverapp.pp(21,52) Hint: Parameter "BroadcastMsg" not used
  3. serverapp.pp(21,80) Hint: Parameter "BroadcastChannel" not used
  4. Error: linker: Undefined symbols for architecture x86_64:
  5. Error: linker:   "_enet_address_set_host", referenced from:
  6.   "_enet_deinitialize", referenced from:
  7.       _UENETCLASS$_$TENETCLASS_$__$$_DESTROY in uenetclass.o
  8.   "_enet_host_broadcast", referenced from:
  9.       _UENETCLASS$_$TENETCLASS_$__$$_BROADCASTMSG$BYTE$POINTER$LONGINT$TENETPACKETFLAGS$BOOLEAN$$BOOLEAN in uenetclass.o
  10.       _UENETCLASS$_$TENETCLASS_$__$$_PROCESSMSG$$BOOLEAN in uenetclass.o
  11.   "_enet_host_connect", referenced from:
  12.       _UENETCLASS$_$TENETCLASS_$__$$_CONNECT$ANSISTRING$WORD$$BOOLEAN in uenetclass.o
  13.   "_enet_host_create", referenced from:
  14.       _UENETCLASS$_$TENETCLASS_$__$$_INITHOST$$BOOLEAN in uenetclass.o
  15.   "_enet_host_destroy", referenced from:
  16.       _UENETCLASS$_$TENETCLASS_$__$$_DEINITHOST in uenetclass.o
  17.   "_enet_host_flush", referenced from:
  18.       _UENETCLASS$_$TENETCLASS_$__$$_FLUSHMSG in uenetclass.o
  19.   "_enet_host_service", referenced from:
  20.       _UENETCLASS$_$TENETCLASS_$__$$_CONNECT$ANSISTRING$WORD$$BOOLEAN in uenetclass.o
  21.       _UENETCLASS$_$TENETCLASS_$__$$_PROCESSMSG$$BOOLEAN in uenetclass.o
  22.   "_enet_initialize", referenced from:
  23.       _UENETCLASS$_$TENETCLASS_$__$$_CREATE$WORD$BOOLEAN$$TENETCLASS in uenetclass.o
  24.   "_enet_packet_create", referenced from:
  25.       _UENETCLASS$_$TENETCLASS_$__$$_SENDMSG$BYTE$POINTER$LONGINT$TENETPACKETFLAGS$BOOLEAN$$BOOLEAN in uenetclass.o
  26.       _UENETCLASS$_$TENETCLASS_$__$$_SENDMSGEVENTPEER$POINTER$LONGINT$TENETPACKETFLAGS$BOOLEAN$$BOOLEAN in uenetclass.o
  27.       _UENETCLASS$_$TENETCLASS_$__$$_BROADCASTMSG$BYTE$POINTER$LONGINT$TENETPACKETFLAGS$BOOLEAN$$BOOLEAN in uenetclass.o
  28.       _UENETCLASS$_$TENETCLASS_$__$$_PROCESSMSG$$BOOLEAN in uenetclass.o
  29.   "_enet_packet_destroy", referenced from:
  30.       _UENETCLASS$_$TENETCLASS_$__$$_PROCESSMSG$$BOOLEAN in uenetclass.o
  31.   "_enet_peer_disconnect", referenced from:
  32.       _UENETCLASS$_$TENETCLASS_$__$$_DISCONNECT$BOOLEAN$$BOOLEAN in uenetclass.o
  33.   "_enet_peer_disconnect_now", referenced from:
  34.       _UENETCLASS$_$TENETCLASS_$__$$_DISCONNECT$BOOLEAN$$BOOLEAN in uenetclass.o
  35.   "_enet_peer_ping", referenced from:
  36.       _UENETCLASS$_$TENETCLASS_$__$$_PING in uenetclass.o
  37.   "_enet_peer_reset", referenced from:
  38.       _UENETCLASS$_$TENETCLASS_$__$$_CONNECT$ANSISTRING$WORD$$BOOLEAN in uenetclass.o
  39.   "_enet_peer_send", referenced from:
  40.       _UENETCLASS$_$TENETCLASS_$__$$_SENDMSG$BYTE$POINTER$LONGINT$TENETPACKETFLAGS$BOOLEAN$$BOOLEAN in uenetclass.o
  41.       _UENETCLASS$_$TENETCLASS_$__$$_SENDMSGEVENTPEER$POINTER$LONGINT$TENETPACKETFLAGS$BOOLEAN$$BOOLEAN in uenetclass.o
  42. ld: symbol(s) not found for architecture x86_64
  43. An error occurred while linking
  44. Error: Error while linking
  45.  
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: reliable udp example
« Reply #6 on: January 20, 2019, 12:49:26 pm »
Yes, but when i build exaxmples return this
...
Error: linker: Undefined symbols for architecture x86_64:
Bitness mismatch. Ensure your enet library is 64-bit as your code. It builds smoothly on my 64-bit Manjaro Linux.

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: reliable udp example
« Reply #7 on: January 20, 2019, 02:09:40 pm »
Yes, I think so, but I was told that RUDP is more powerful than TCP in terms of speed.
Well, https://en.wikipedia.org/wiki/Reliable_User_Datagram_Protocol tells me it is not a standard and as such you would need to implement both client and server yourself.
Since it is not a standard, I can not help you this time.
Specialize a type, not a var.


diego bertotti

  • Full Member
  • ***
  • Posts: 101
Re: reliable udp example
« Reply #9 on: December 04, 2019, 01:57:23 pm »
The bindings for this library are included by default in fpc (look into FPC_FOLDER/packages/libenet/examples).

They're not present in FPC 3.0.4 for Windows.


i found it on "lazarus/fpc/examples/"

 

TinyPortal © 2005-2018