5. Februar 2009 

Hi All,

Below is a very simple 4D TCP server and client to see how one can start to learn how to use 4D IC low level TCP calls.

The same basic ideas here can also be used with pluggers.nl NTK TCP plugin for 4D which is more robust than 4D's low level TCP calls from what I have seen.

The basic code took me about 20 minutes to write so it's not the most elegant or sophisticated bit of code for a TCP server.

I ended spend more time on commenting and cross check the code than actually create the server + client methods.

The code is working but you may need to adjust things if you start tweaking things around so beware.

Rather it's meant to help someone to grasp what it takes to get going with low level TCP calls within 4D

It has some junk in there to help a newbie to learn from, so don't start ripping it apart complaining I would never do this or that. ;-)

There are many tricks and styles that can be used to shape specific TCP IP needs be it a client or server.

As I have mentioned in previous iNUG threads that in the end if you know and can grasp low level TCP call handling with 4D.

That sometimes it faster and better to do it all within 4D as you will have the complete control over the entire process to do exactly what you need and how it works with far fewer limitations on your final results.

Other possible use for these TCP ideas could be used to talk within or to other 4D process.

As well as you should be able to talk with any other program on your computer than you can send and receive TCP socket calls from such as Python, PHP or Ruby etc.

Remember a socket is a socket.

Doesn't matter if it is coming to or from your local machine, Or half way across the world it's still all just a socket connection to deal with.

You will have issues to deal with when going through firewalls and all etc. but a socket is a socket.

TCP IP opens up new ways for you to expand your 4D world.

This code text can be downloaded from my website here.

Have fun.


der Code als PDF

4D Themen: Berichte in Arbeit