Jump to content
Xtreme .Net Talk

How to make a program that is linked with other instance in other computer...


Recommended Posts

Posted

Hello. I want to make a simple program, imagine a chess simulator, (only moves pieces, no aI). The idea is that the game is ran in computer A and other person is playing in computer B, and the good thing is that they are to be linked so the people is actually playing together.

 

Sure, there must be a way for everything, the point is that this is the first time I came into this problem and I wanna face it step by step. I have heard or (read?) something about DirectX stuff, but that is to advanced for me right now. Any help, thnks!! :p

Posted

The easiest way is to have both iterations of the program look at a shared directory, and using a shared file or files.

 

Basically, if a file called "CompAMove.txt" exists, Computer A is moving. Part of the move on Computer A will be to write something to another file ("GameMoves.txt" or something) to denote what it did. It then deletes the "CompAMove.txt" file and creats "CompBMove.txt" and waits for that file to NOT exist.

 

Meanwhile, Computer B is watching the shared folder for "CompAMove.txt" to NOT exist and proceeds with its move.

 

It is a brute-force method which requires no actual computer-to-computer communications, but it would work.

 

Just a thought.

 

Others?

The three most important things in life: God, your family, and the Green Bay Packers -- Not necessarily in that order.

Winning is not a sometime thing. You don't win once in a while, you don't do things right once in a while, you do them right all the time. Winning is a habit. Unfortunately, so is losing.

-- Vincent T. Lombardi
Posted

That would certainly do it.

 

I was going for the low-tech, though not really "easier" approach. ;)

The three most important things in life: God, your family, and the Green Bay Packers -- Not necessarily in that order.

Winning is not a sometime thing. You don't win once in a while, you don't do things right once in a while, you do them right all the time. Winning is a habit. Unfortunately, so is losing.

-- Vincent T. Lombardi
Posted

OH, that's it!!. I must thank you for your response <SteveoAtilla> it was fast and accurate 'cause I want to start fresh, and then when things will turn messy and UN-Cool I will jump to other (harder) methods.

 

Let me ask one more thing... <mutant> said something about SOCKETS, I've heard that before, Im not sure what it is but I suppose now it is intended for communications and stuff. So the question is, (in a distant future) when I get enough of brutal ways to do my thing, is that (SOCKETS) the topic I should study?

Posted
Georgen, you do not want to go the shared folder route. That is about the crappiest way possible of peer-peer communication. Do it the right way and learn about sockets.
Posted
Georgen' date=' you do not want to go the shared folder route. That is about the crappiest way possible of peer-peer communication. Do it the right way and learn about sockets.[/quote']

Diesel,

 

Sometimes, I personally find that the best way for me to learn to do something the right way is to first do it the wrong way. Georgen will certainly learn how to do peer-to-peer communications using the Shared Folders method, but as you and I know, it is not the most efficient or even a good way to do it. By doing it this way, however, he will learn this firsthand.

 

Maybe, instead of tearing down the method, encourage the person who is willing to learn by doing.

 

Georgen, as far as sockets are concerned, here is one tutorial, but I just did a Google search for "VB.NET SOCKETS".

 

Good luck!

 

Kahuna

The three most important things in life: God, your family, and the Green Bay Packers -- Not necessarily in that order.

Winning is not a sometime thing. You don't win once in a while, you don't do things right once in a while, you do them right all the time. Winning is a habit. Unfortunately, so is losing.

-- Vincent T. Lombardi
Posted
Thanks a LOT guys!! I wanna try both ways. I can guess the shared folder way is nonsense for real stuff, but I want first to understand the basics. I'll let you know of my advances with it!! Thanks again!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...