Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: UDP Datagrams  (Read 7312 times)

0 Members and 1 Guest are viewing this topic.

Mia

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 101
  • Generic Amiga User
UDP Datagrams
« on: August 01, 2016, 10:35:09 AM »

As I'm quite active with AMOS at the moment I'd like to share: I've seen many questions online regarding UDP, but I don't think many people actually understand the BSD library - I've just got a UDP Echo Server <> Client connection working in AMOS by following John Bintz' BSDSocket.Library example. I've done quite a bit of socket programming and followed the C source and the amiga include files and found that by making just one change to the SOCK_NEW procedure: change Dreg(1)=1 to Dreg(1)=2  - it changes the socket over from Stream to Datagram mode and the rest of the code works as-is so you can read and write to the socket with UDP. John Bintz's code uses the EasyLife extension for talking to the DNS server with commands Elword$ and Ellong$- but I've got no idea what they do  ::)... I don't need DNS so I won't be "completing" it but I wanted to share that it is possible to use UDP with AMOS already (woohoo) - I'm so glad this part is being done  with the BSD library and not an extension...

http://aminet.net/package/dev/amos/BSDSocket
Code: [Select]
Proc BSD_OPEN
SOCK_OPENCONNECTION["192.168.1.4",5500]
MY_SOCKET=Param
Repeat
   Input ">>";I$
   SOCK_SENDSTRING[MY_SOCKET,I$]
   Repeat
      SOCK_READSTRING[MY_SOCKET,256]
      Print Param$
   Until Param$=""
Until I$="exit"
SOCK_CLOSE[MY_SOCKET]
Proc BSD_CLOSE

The attached udpserver.c compiles with gcc on AmigaOS4.1, Linux & Aros
« Last Edit: August 01, 2016, 01:36:06 PM by Mia »
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: UDP Datagrams
« Reply #1 on: August 03, 2016, 09:33:27 PM »

but wouldn't it be nice to wrap the BSD library and commands up in an extension? ;)

I am thinking for ease-of-use to the less network literate (like myself)

I'd love to see some practical examples of how this could be applied to a multiplayer game or something. :)
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

Mia

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 101
  • Generic Amiga User
Re: UDP Datagrams
« Reply #2 on: August 03, 2016, 10:31:38 PM »

but wouldn't it be nice to wrap the BSD library and commands up in an extension? ;)

I am thinking for ease-of-use to the less network literate (like myself)

I'd love to see some practical examples of how this could be applied to a multiplayer game or something. :)

Yeh totally, I meant that I'm glad I don't have to use any of the existing extensions - I've stripped my system down to just 3 extensions for compiling as I found adding extensions bulks out the binaries too much - what we need is a specific network only extension. It is good that the amos code uses the bsd library exactly the way an extension would/should, which makes me wonder if it's possible to write an extension in amos? The extensions that I have seen are all in assembly, and what about C - I know it's quite easy to merge in C code to assembly objects but does anyone use C for writing extensions, it would be perfect for a network extension - if there was an assembly wrapper for an extension written in C I could put this together from the C sources available, defining external link in the assembly- but I couldn't put the assembly together - well, maybe I could, but it would be more work than worth it as I already have the amos calllib defs...

and yeh a multi player networked game would be cool, I need udp for sending audio data so a plugin for fxbox is the first step - but maybe i can think a bit more about what we need in multi-player stuff. If there is a specific game (with source) you are thinking of I could hack it in there, it would be good practice... I did make up a game called "Sumo Mouse" a few years ago, but I just laugh when I think about as it would be a lot of work but pretty boring to play :o anyway, any other ideas are welcome  :)
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: UDP Datagrams
« Reply #3 on: October 31, 2016, 08:08:33 PM »

Yeh totally, I meant that I'm glad I don't have to use any of the existing extensions - I've stripped my system down to just 3 extensions for compiling as I found adding extensions bulks out the binaries too much

Out of curiosity which 3 extensions are left? ???

Also, there are 3rd party compression tools available. I use them alot as I like my stuff to be contained on 1 disk - easy to distribute and boot, but requires an Amiga with a minimum of 2MB to handle my software due to the way I make them.
Logged

Mia

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 101
  • Generic Amiga User
Re: UDP Datagrams
« Reply #4 on: November 03, 2016, 08:59:46 PM »


Out of curiosity which 3 extensions are left? ???


1 - AMOSPro_Music.Lib
2 -
3 - AMOSPro_Request.Lib
4 -
5 - AMOSPro_Compiler.Lib

I usually compress, but I have 2 issues with running a cruncher on the fxbox binary:
1, fxbox will still crash if you fragment the memory too much so I'm wary of having those decompression buffers before it runs.
2, load times from floppy disk - the binary about 200K uncompressed, not including the AMOS.Library and the current design supports floppy based amigas so the extra delay during decompression makes the memory crashes unbearable  :o - The plugins are generally quite small and compressed using the compiler squash option.

I remeber something called the Titanics Cruncher that could decrunch while loading, that would be cool to try?


re: the datagrams, I've settled on using the AMOS procedures, but modified them to GOSUB's for speed!!!
« Last Edit: November 03, 2016, 09:13:32 PM by Mia »
Logged

Mia

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 101
  • Generic Amiga User
Re: UDP Datagrams
« Reply #5 on: November 03, 2016, 09:29:10 PM »

I'd love to see some practical examples of how this could be applied to a multiplayer game or something. :)

I've been able to apply part of OSC, the network sync processes from http://www.rossbencina.com/code/oscpack - and can do basic syncing over the network - from what I've seen the protocol handles all sorts of data so can be applied to games as well, it's worth looking at.
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: UDP Datagrams
« Reply #6 on: November 08, 2016, 08:39:46 PM »


Out of curiosity which 3 extensions are left? ???


1 - AMOSPro_Music.Lib
2 -
3 - AMOSPro_Request.Lib
4 -
5 - AMOSPro_Compiler.Lib

Ahhh, of course! Thanks  :)

I remeber something called the Titanics Cruncher that could decrunch while loading, that would be cool to try?

That does sound cool. Personally I use Shrinkler 4.4, there are multiple versions of it (e.g. Windows, Linux, OSX, Amiga) so you can compress it on your favourite system and it always produces 68K output. However, it loads first then decrunches before running your code, but is still pretty fast I think.
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022