Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Networking Info

Posted on 1998-05-10
26
Medium Priority
?
175 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
ID: 1344112
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
ID: 1344113
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
ID: 1344114
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:ZifNab
ID: 1344115
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
ID: 1344116
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
ID: 1344117
Oops, above should be a comment, sorry !
0
 
LVL 1

Author Comment

by:SJohnson
ID: 1344118
d003303,

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

Stu
0
 
LVL 1

Author Comment

by:SJohnson
ID: 1344119
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
ID: 1344120
Sjohnson, looked at F Piette site?
0
 
LVL 4

Expert Comment

by:d003303
ID: 1344121
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
ID: 1344122
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
ID: 1344123
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
ID: 1344124
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
 
LVL 1

Author Comment

by:SJohnson
ID: 1344125
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
ID: 1344126
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
ID: 1344127
;-) 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
ID: 1344128
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
ID: 1344129
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
ID: 1344130
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
ID: 1344131
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
ID: 1344132
Zif: Can you email me with your email address :)  Stuartj@futureschool.com.au

Ta

Stuart.
0
 
LVL 1

Author Comment

by:SJohnson
ID: 1344133
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
ID: 1344134
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
ID: 1344135
Yo Stuart, how is the web-page? Find already what you needed?
0
 
LVL 1

Author Comment

by:SJohnson
ID: 1344136
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 900 total points
ID: 1344137
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

926 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