Answered by:
Applications Connecting Between Computers

Question
-
I am part of a programming class at my school and I've wanted to start making applications (we use c#) that can run and connect through LAN between computers and I've been curious as to how I might achieve this.
I'm aware that the Microsoft SQL server and host things but I don't think it does what I want to achieve.
I want to make a tic-tac-toe application that me and my friend can launch on separate computers and one of us can host a game, and the other connects to it. I want to be able to chose if I want to play X or O, and same for my friend. I also want to be able to select my tile on my turn and again, same for my friend.
Is this possible? Running applications that connect to each other on LAN?
Thanks
- Seth
- Edited by Seth Rabourn Tuesday, November 10, 2015 2:51 PM
- Moved by Weiwei Cai Tuesday, November 17, 2015 6:11 AM not VS IDE problem
Tuesday, November 10, 2015 2:40 PM
Answers
-
You should research how applications can communicate directly via LAN.
You are in a programming class but make no mention of what level of skills you are learning. I'm suspecting since you don't understand the capabilities available that your programming as well as IT skillset is not to the level you should have for what you need to know. It's one thing to program and another to understand Computers and devices such as Smart Phones with an IT knowledge of them beforehand well enough to know how to program for them.
Communicating across a LAN is simple using TCP/IP or UDP/IP. However the techniques required to make it work correctly are not in your scope of knowledge and probably you have extremely limited if any knowledge of networking since you asked this question. For TCP you can use a TCP Client and TCP Listener to wait for calls from the TCP Client. UDP has the same capability. You can use the MSDN Library search engine to search for the UDP equivalent.
However games usually use a server such that players can connect to a server to start a game between two players which would be more difficult and you would need to learn about that.
There's also System.Net namespace that can be used to get an IP address for a LAN PC's host name for the LAN if the IP address is not known so that two systems apps can connect to each other correctly. Also you will need to use one or possibly two logical port(s) which is/are not in use by any other applications or services on the PC's in question.
As far as the actual game goes the apps have to connect prior to a game beginning and allowing either player to select whether they will be X or O since the first player that chooses should be the only one allowed to be X or O and I suppose a timestamp would be needed to determine who chose first if both choose at basically the same time.
Maybe you should practice programming some games that are single player prior to attempting something you don't probably have the skillset for. Getting Started Tutorials should provide some insight on possibillities with 4 different apps to learn from since Tic/Tac/Toe is fairly simple.
Maybe view some videos to attempt to get an understanding of IP communications. These videos are just for learning C# The New Boston Videos although they have more videos for a large variety of other learning. You should be able to find videos for learning IP via C# programming on the net.
You also may want to download WireShark Network Protocol Analyzer for use in analyzing the data sent and received by your apps if necessary. Also note that Firewalls and Anti-Malware/Virus software can block or detect apps as viral in nature depending on their settings so it's possible you could create an app to run on a LAN PC using the LAN to intercommunicate and the intercommunication could be blocked or the app could be disallowed to run by security software.
La vida loca
- Edited by Mr. Monkeyboy Tuesday, November 10, 2015 3:20 PM
- Proposed as answer by Weiwei Cai Wednesday, November 11, 2015 5:13 AM
- Marked as answer by Dave PatrickMVP Sunday, November 22, 2015 9:53 PM
Tuesday, November 10, 2015 3:19 PM
All replies
-
You should research how applications can communicate directly via LAN.
You are in a programming class but make no mention of what level of skills you are learning. I'm suspecting since you don't understand the capabilities available that your programming as well as IT skillset is not to the level you should have for what you need to know. It's one thing to program and another to understand Computers and devices such as Smart Phones with an IT knowledge of them beforehand well enough to know how to program for them.
Communicating across a LAN is simple using TCP/IP or UDP/IP. However the techniques required to make it work correctly are not in your scope of knowledge and probably you have extremely limited if any knowledge of networking since you asked this question. For TCP you can use a TCP Client and TCP Listener to wait for calls from the TCP Client. UDP has the same capability. You can use the MSDN Library search engine to search for the UDP equivalent.
However games usually use a server such that players can connect to a server to start a game between two players which would be more difficult and you would need to learn about that.
There's also System.Net namespace that can be used to get an IP address for a LAN PC's host name for the LAN if the IP address is not known so that two systems apps can connect to each other correctly. Also you will need to use one or possibly two logical port(s) which is/are not in use by any other applications or services on the PC's in question.
As far as the actual game goes the apps have to connect prior to a game beginning and allowing either player to select whether they will be X or O since the first player that chooses should be the only one allowed to be X or O and I suppose a timestamp would be needed to determine who chose first if both choose at basically the same time.
Maybe you should practice programming some games that are single player prior to attempting something you don't probably have the skillset for. Getting Started Tutorials should provide some insight on possibillities with 4 different apps to learn from since Tic/Tac/Toe is fairly simple.
Maybe view some videos to attempt to get an understanding of IP communications. These videos are just for learning C# The New Boston Videos although they have more videos for a large variety of other learning. You should be able to find videos for learning IP via C# programming on the net.
You also may want to download WireShark Network Protocol Analyzer for use in analyzing the data sent and received by your apps if necessary. Also note that Firewalls and Anti-Malware/Virus software can block or detect apps as viral in nature depending on their settings so it's possible you could create an app to run on a LAN PC using the LAN to intercommunicate and the intercommunication could be blocked or the app could be disallowed to run by security software.
La vida loca
- Edited by Mr. Monkeyboy Tuesday, November 10, 2015 3:20 PM
- Proposed as answer by Weiwei Cai Wednesday, November 11, 2015 5:13 AM
- Marked as answer by Dave PatrickMVP Sunday, November 22, 2015 9:53 PM
Tuesday, November 10, 2015 3:19 PM -
I appreciate your answering my question.
I have infact coded games with the VS software and do understand. I'm in the advanced class at my school. Considering thats a high school, not too big of an achievement, but still. I know about programming with C#.
You're correct in assuming I don't have the skillset for this, that's why I'm asking.
Like I said, I appreciate your feedback but it seems like you've tried to professionally call me an idiot.
Moving on from my defense though.
I don't want to have a server client and then the users connect to a server, I want to be able to host a listen server directly from the application. Thank you for pointing me in the right direction.
"Good is the enemy of great." - James C. Collins
- Edited by Seth Rabourn Thursday, November 12, 2015 10:41 PM
Thursday, November 12, 2015 10:40 PM -
Thanks for Mr. Monkeyboy's help.
Hi James C. Collins,
You know that actually this forum is to disucss the VS IDE, so it seems that it is not the correct forum for this issue.
Based on your descritption, this issue is related to the game development and deployment , am I right?
Maybe you could share us the real technology you use in your app, so we could provide you the correct developing forum. For example, as far as I know, for the Games, it has his own support forum here:
http://xboxforums.create.msdn.com/forums/
But I'm not very sure that whether your games app is related to the directx or others.
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Saturday, November 14, 2015 11:11 AM -
I appreciate your answering my question.
I have infact coded games with the VS software and do understand. I'm in the advanced class at my school. Considering thats a high school, not too big of an achievement, but still. I know about programming with C#.
You're correct in assuming I don't have the skillset for this, that's why I'm asking.
Like I said, I appreciate your feedback but it seems like you've tried to professionally call me an idiot.
Moving on from my defense though.
I don't want to have a server client and then the users connect to a server, I want to be able to host a listen server directly from the application. Thank you for pointing me in the right direction.
"Good is the enemy of great." - James C. Collins
That would be rather difficult since I am not a professional.
On the other hand I don't try to implement things without bothering to study how to do so beforehand. Highschool or college doesn't really matter if you are unwilling to put in the time to use the internet to learn prior to deciding to write some program just because an idea came to you.
I'd like to build a jet and I have a welder. You want to be the test pilot when I get done?
La vida loca
Monday, November 16, 2015 12:56 AM