PDA

View Full Version : NetworkEngine.pas for JEDI-SDL



jdarling
10-11-2006, 06:42 PM
After fighting and fighting with getting the SDL_Net stuff working I finally got it :). I've wrapped the network stuff up into a nice little object package that includes a server and client object that have string and block support. Since I had such a hard time, I thought others might like to have a bit of a support unit themselvs. Maybe I'll be lucky enough that this is useful enough and it will be included in the lib itself :).

Download From: http://www.eonclash.com/SDL/NetworkEngine.zip

Included is the actual NetworkEngine.pas file as well as a sample Server and Client application. These work with the standard SDL_Net demos that are available already as an added bonus.

vgo
11-11-2006, 10:35 AM
This is nice, I'm gonna give it a go. :)

cairnswm
13-11-2006, 05:21 AM
Does this unit use TCP or UDP connections?

Well done by the way - I think this will be used by a lot of people. Maybe Savage can add it to JEDI-SDL ver 1 release.

savage
14-11-2006, 08:19 PM
I'll have a look at it shortly.

jdarling
14-11-2006, 10:34 PM
This is the TCP version, and I found a problem with it today (that I need to fix and upload). Basically look for the line "for i := 0 to Clients.Count -1 do" and change it to "for i := Clients.Count -1 downto 0 do" within the Server Update method. I forgot that I remove clients in that loop, and going 0 to max-1 causes issues as we all know :).

I'm still working out the UDP version, and it will be a bit before I get back to it. I think (hopefully) that the switch is easy to make. Looking at SDL docs its almost as simple as replacing TCP with UDP.