Solved

Networking Info

Posted on 1998-05-10
26
157 Views
Last Modified: 2010-04-06
I need to be able to share data between programs (two or more) over a LAN running TCP/IP.  Can anyone tell me how I can do this.  It needs to be quick and without using drop files or a database.

An example would be something like DOOM where one client can see other clients and vise-versa.  We need to be able to do the same thing (without the game aspect of cause).

Any help would be appreciated.
0
Comment
Question by:SJohnson
  • 12
  • 7
  • 3
  • +3
26 Comments
 

Expert Comment

by:yduke
Comment Utility
Can you specify what format is data you want to share? And when you say shared between programs you mean different programs or the same program running from different machines.  If you can be more specific on your task we may be able to help.

yduke
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Its hard to say at this stage what the data will be.  Probably just a record at a time (no bigger than say 10k I would say).

It will be the same program sharing the data, or passing it back and forth.

I also need a main program which will intercept the data and process it.  This needs to be transparent (the others wont know its happening).

The project is for a game which is to go into schools.  Its part of our extra curricular activity program.

Do you need some more info, or will this surfice at the moment?

Stu.
0
 
LVL 1

Expert Comment

by:cmain
Comment Utility
Have you thought about using Sockets.

Delphi has components TWinClientSocket and TWinServerStocket. They are not built into the component palette by default.

The components are located in the internet subdirectory (in the delphi source directory) The file is called Scktcomp.pas.

If you are running TCP/IP it's very easy to use. You just specify the server name, and the client and server can then send data to one another. The components are quite easy to use. They trigger events when new data is ready.

I would definitly recommend this method.
Another option is to create pipes.
You will have to see the CreatePipe API. The disadvantage of pipes is that the server must be an NT Server.

Another method is mailslots. See CreateMailSlot.
Mailslot and socket servers can run on 95 machines, so you are not limited to an NT server. The trouble with mailslots is that they are a little unreliable. Data will not arrive in the same order that it left, and you are not told if data is lost.

I would go with the sockets option.
Regards
-craig.
PS : Let me know if this answers your question.
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Hi SJohnson,

I don't know much yet about such applications, but I'm working on it.... Do you know of the site of Francois Piette? I suggest you look at it... It's really good and lots of demo's with it It has also a great mail list ..... And it's only CARDWARE.... free!

http://www.rtfm.be/fpiette/indexuk.htm

It has everything!!!! I really mean it....

Regards, Zif.
0
 
LVL 4

Expert Comment

by:d003303
Comment Utility
Yo,
the basic thing is that you have to decide between server-based communications or peer-based communications. The more reliable is server -based, where all synchronization is managed on a server machine. The peer-based thing would be that all peers synchronize each other.
For game synchronization, I recommend that you differ between "Start network game" and "Join network game". "Start network game" would set up a server on that machine, and "Join network game" would connect that machine as a client to the server.
Now, the server manages the traffic and sends synchronization events to all the clients. Also, each client sends synchronization events to the server.
0
 
LVL 4

Expert Comment

by:d003303
Comment Utility
Oops, above should be a comment, sorry !
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
d003303,

Thanks for the info, I'll reopen the question though.

Stu
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Craig,

I just had a quick scan through my D3 directory and couldnt find the scktcomp.pas you mentioned.  I am using D3 Professional - could that unit be included only on D3 Client/Server?

Any ideas???

Stu
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Sjohnson, looked at F Piette site?
0
 
LVL 4

Expert Comment

by:d003303
Comment Utility
Yo,
I use D3 Pro, too, and scktcomp.pas resists in .\Delphi 3\Source\Internet on my installation.

Slash/d003303
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Strange.  I'll have a look on the CD and see if I can find it.


ZifNab:  I have had a look through that site you mentioned, and although it does offer a lot of networking info, there doesnt seem to be anything I can really do to accomplish what I want to do.

I had a look at his WSocket component, and although it works fine communicating between two PCs, having more than that is impossible.  I need to have at least two machines talking to one and vise vera.  
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Strange.  I'll have a look on the CD and see if I can find it.


ZifNab:  I have had a look through that site you mentioned, and although it does offer a lot of networking info, there doesnt seem to be anything I can really do to accomplish what I want to do.

I had a look at his WSocket component, and although it works fine communicating between two PCs, having more than that is impossible.  I need to have at least two machines talking to one and vise vera.  
0
 
LVL 1

Expert Comment

by:ergates
Comment Utility
I don't know in detail how Doom works but I would guess its using broadcast or multicast datagrams. These are quick and simple but have no reliability.

I expect each Doom game broadcasts a record containing the state of the game for that player. It also listens for the broadcast states of the other players and incorporates them into its own game.

Using UDP sockets is easy with the ICS (F.Piette's stuff), but I'm not too sure about multicast in winsock. You could use a broadcast address if you don't mind other machines on the netwoek being slowed down. 10k is quite a lot of data to send but it depends on often you send it. The basic architecture is very roughly

loop
  update game display
  send my state to everyone
  if receive data available then
     read other player state
  endif
endloop

With UDP, you just do send() to send data. To receive you do a bind() on whatever port you use, then poll occasionally with select() to see if data is waitng (or use an event), and recv() to get the data.

I have seen network "chat" programs using UDP, which is very similar to what you want to do. They are often packaged with various socket components, and if you could get hold of one these you can adapt it or learn the technique from it.

I hope this gives you some ideas.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Author Comment

by:SJohnson
Comment Utility
ergates:

Can you tell me where I might be able to find some source to get me going?  It seems as if we are heading in the right direction now.  

Thanks

Stuart
0
 
LVL 1

Expert Comment

by:ergates
Comment Utility
Francois Piette's ICS has an example UDP Send and UDP listen
programs http://www.rtfm.be/fpiette/files/udpdemo.zip

There is also a a Chat progran, but it appears to be in C++
http://www.rtfm.be/fpiette/files/twschat.zip

Have fun
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
;-) What ever you want to get, you 'll always need the components of F. Piette ;-). PS. What about asking that question on there mailing list? Very excellent help and quick!
Enjoy...
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Im just checking out the stuff from F. Piettes' site now.  If I can get it working flawlessly & bi-direction, then the problem is solved!

Thanks for the info.
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
I've had a look at the UDP stuff and it works perfectly.  But I still haven't achieved what I really want to do.  I want bi-directional communications between more than two PCs.  With the examples I have so far (the chat programs), it seems that I can only have two PCs.

Any ideas??
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Ask the question on there mailing list, .... they have more experience in these communications... If you want I ask it (because you don't want to register for the components yet = sending a postcard, OR you want to know it before your card arrives there) just formulate  exactely what you want to know and I'll forward the mails to you (I need your email then too..) c.u. ZiF.
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
I'll reopen this question tomorrow if nothing else has come from ergates.

ZifNab: I'll write something up and send it too you along with my email address.  That will be done tomorrow.  Thanks for the offer.

Stu.
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Zif: Can you email me with your email address :)  Stuartj@futureschool.com.au

Ta

Stuart.
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
ergates,

I have had minor success using UPD, unfortunately it has a lot of problems when more than 10 machines are polling to the same server.  I have tried a few methods and I am not really having any luck getting it to work properly.

I am going to try a different method using direct network calls, but I think I am biting off a bit more than I can chew :)

Thanks for your help anyway,


Stuart.
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Ok, here again, for all who are interested in this subject, look at this url :

http://www.webgamedeveloper.com/

toytoy, Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Yo Stuart, how is the web-page? Find already what you needed?
0
 
LVL 1

Author Comment

by:SJohnson
Comment Utility
Zif:

That page was great!  There was heaps about using Direct X and Direct Play in it which I think should do what we are looking for.

I'll let you know ASAP.  I should be able to start doing something with it today, if not tomorrow.

Stu.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 450 total points
Comment Utility
Hi Stu,

If you are going to use DirectX, then look at this page :

 www.ingjapan.or.jp/hori/index.e.html

or download Hori's DelphiX components at :

 torry.rimini.com/vcl/packs/hhdelphix.zip

Have fun!

If all the things didn't help you to find the answer or somebody else gave you better information, just reject this answer.

PS. Let me know how the kids like your program!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now