Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation
Want to Learn Lan Emulation Want to Learn Lan Emulation
Want to Learn Lan Emulation
Go Back  Xtreme Visual Basic Talk > > > Want to Learn Lan Emulation


Reply
 
Thread Tools Display Modes
  #1  
Old 05-08-2009, 07:29 PM
-Learn- -Learn- is offline
Newcomer
 
Join Date: May 2009
Posts: 13
Default Want to Learn Lan Emulation


Hi, I use 'VB.Net 2005' and I am of course already familiar with simple things like: loops, functions, objects, classes etc..

I would like to create an application that allows: multiplayer-games to be played via the LAN option over the Internet. It's a Sort of LAN Emulation over the Internet (or virtual LAN emulation).

However, everything that touches the "Internet with VB.Net programming" is still new to me.

-> Can anyone give me some help about where to start? or What should I learn first?

-> Some guides, or samples, or list of things that I should learn before starting this project? or existing library that can be imported?

Any Help please?

Last edited by -Learn-; 05-08-2009 at 07:35 PM.
Reply With Quote
  #2  
Old 05-08-2009, 08:43 PM
Qua's Avatar
QuaWant to Learn Lan Emulation Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

I'm not quite sure where you're going. You want to play multiplayer over the internet as a LAN? LAN is per definition a Local Area Network so as soon as your start to connect via internet it is not longer a LAN game, but an internet game. If that is indeed what you're interested in, then the System.Net.Socket namespace contains a lot of functionality for connecting both locally and via the internet.

To build a game with network support there is a few key subjects that you must master:
  • Threading: You won't be able to do any network programming without making use of threads. Not if your game is in real time anyway.
  • Learning the Socket/Net namespaces. Especially the TcpClient and TcpListener might come in handy if you're planning to use the TCP protocol for communicating.
Besides learning how to do the programming, there is a problem with simple client to client connections; almost everyone is behind either a firewall or a router at which does not allow incomming network requests. That means that the users of your program won't be capable of hosting the game.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #3  
Old 05-08-2009, 09:17 PM
Eradicator Eradicator is offline
Junior Contributor
 
Join Date: May 2008
Posts: 300
Default

I think he means something along the lines of Hamachi.
Reply With Quote
  #4  
Old 05-08-2009, 09:30 PM
Qua's Avatar
QuaWant to Learn Lan Emulation Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Quote:
Originally Posted by Eradicator View Post
I think he means something along the lines of Hamachi.
Building a program that simulates a virtual local network, even though using the internet for connecting is no easy task at all, and from the experience that you describe you have with VB.NET I'd say that it'd be a near impossible project to implement.

Hamachi is use really low level code to simulate a virtual network card in your computer, so it would require quite a bit of work with the windows API which just would add to the complexity of the project since you'd properly find close to no documentation or guides online that described this process using managed code.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #5  
Old 05-08-2009, 10:19 PM
Rockoon's Avatar
Rockoon Rockoon is offline
Joseph Koss

* Guru *
 
Join Date: Aug 2003
Location: Unfashionable End
Posts: 3,615
Default

Quote:
Originally Posted by Qua View Post
Besides learning how to do the programming, there is a problem with simple client to client connections; almost everyone is behind either a firewall or a router at which does not allow incomming network requests. That means that the users of your program won't be capable of hosting the game.
I have no solution for the OP, but I feel a small detailed explanation is needed here.

As far as firewalls, most people are only behind a software firewall......which happily ask the user "Would you like this program is act as a server?" or similar query. Firewalls are not the problem.

The problem is the NAT routers, which do not automatically know what to do when blindsided by unexpected incomming packets.

From a purely technical point of view, a packet is a packet is a packet. All packets you every recieve are all addressed to the NAT (the ROUTER is assigned an IP address by your ISP, and your entire local network shares that same IP address.)

Under normal conditions, such as when performing a google search, the NAT router knows which machine on the network made the request.. fills in some special routing info on the outbound packet so that when it gets a response it knows which machine to forward it to.

In the case of trying to act as a server, however, that special routing information is not present in suprise packets.. it has no idea what to do with the them!

The solution is to configure the NAT to port-forward to a specific machine when it sees suprise packets destined for a specific port. A website has even been devoted to helping users configure their NAT routers to do exactly this, called portforward.com.

The NAT layer was created as a solution to the IPv4 problem of there not being enough 32-bit IP addresses for every machine/device that needs an internet connection. Even though IPv6 is now ready to be supported almost everywhere, we are unfortunately now stuck with the NAT layer as there is little chance your ISP will be handing out multiple IPv6 addresses to individual customers.
Reply With Quote
  #6  
Old 05-08-2009, 11:54 PM
Eradicator Eradicator is offline
Junior Contributor
 
Join Date: May 2008
Posts: 300
Default

Quote:
Originally Posted by Qua View Post
Building a program that simulates a virtual local network, even though using the internet for connecting is no easy task at all, and from the experience that you describe you have with VB.NET I'd say that it'd be a near impossible project to implement.

Hamachi is use really low level code to simulate a virtual network card in your computer, so it would require quite a bit of work with the windows API which just would add to the complexity of the project since you'd properly find close to no documentation or guides online that described this process using managed code.
I'm assuming that was a misquote, as I was simply clarifying the OP's post.

I realize that would be a difficult task, and one I have no intention of undertaking.
Reply With Quote
  #7  
Old 05-09-2009, 04:16 AM
-Learn- -Learn- is offline
Newcomer
 
Join Date: May 2009
Posts: 13
Default

I have past experience in Java too, & of course already know threading.

-> Maybe developing my application for a single game 'Warcraft III' would be easier?

This is because 2 of my friends actually developed their own applications for this game "in C#" quite quickly.

Else, independent developers also did it in the past & their applications are: 'Lancraft' and 'YAWLE'.

-----
Here is actually a screenshot of the source code of 1 of my friends: http://img5.imageshack.us/img5/4462/picdzh.jpg

He won't share it, just like the developer of 'YAWLE' that I contacted. -.-"

Last edited by -Learn-; 05-09-2009 at 04:39 AM.
Reply With Quote
  #8  
Old 05-09-2009, 10:38 AM
Eradicator Eradicator is offline
Junior Contributor
 
Join Date: May 2008
Posts: 300
Default

Quote:
Originally Posted by -Learn- View Post
Here is actually a screenshot of the source code of 1 of my friends: http://img5.imageshack.us/img5/4462/picdzh.jpg

He won't share it, just like the developer of 'YAWLE' that I contacted. -.-"
I don't see any source code, I just see some WebBrowser code and a file tree.
Reply With Quote
  #9  
Old 05-09-2009, 10:58 AM
Qua's Avatar
QuaWant to Learn Lan Emulation Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Quote:
Originally Posted by -Learn- View Post
I have past experience in Java too, & of course already know threading.

-> Maybe developing my application for a single game 'Warcraft III' would be easier?

This is because 2 of my friends actually developed their own applications for this game "in C#" quite quickly.

Else, independent developers also did it in the past & their applications are: 'Lancraft' and 'YAWLE'.

-----
Here is actually a screenshot of the source code of 1 of my friends: http://img5.imageshack.us/img5/4462/picdzh.jpg

He won't share it, just like the developer of 'YAWLE' that I contacted. -.-"
You friend coded in C#, so you can simply open his application in any disassembler and get the full source code. However, if he was determined not to let anyone see the source, he might have use a code obfuscator to turn the source code into one big unreadable mess.

I'm not quite sure about the legal stuff related to dissambling other people source code, so you might want to check up upon that before doing anything else.

I think they way the programs allow you to play over the internet instead of using the LAN is by manually connecting the two clients. And by doing they, they have to know a tiny bit about the protocol used in the game lobby of WC3.
__________________
Reading is the foundation for all knowledge - Unknown.

Last edited by Qua; 05-09-2009 at 11:20 AM.
Reply With Quote
  #10  
Old 05-09-2009, 11:42 AM
-Learn- -Learn- is offline
Newcomer
 
Join Date: May 2009
Posts: 13
Default

Quote:
Originally Posted by Eradicator View Post
I don't see any source code, I just see some WebBrowser code and a file tree.
Yes, he integrated some sort of web browser in his application. But you can also see the theEye, theEar and Socket.cs too.

The application should not be that difficult, but for sure should first require some hard time of researches before starting.

---
Else, thanks for everyone's answers till now. But, for sure, I will still be happy for any type of guidance that could be useful to me.

Last edited by -Learn-; 05-09-2009 at 11:48 AM.
Reply With Quote
  #11  
Old 05-09-2009, 02:15 PM
Eradicator Eradicator is offline
Junior Contributor
 
Join Date: May 2008
Posts: 300
Default

Quote:
Originally Posted by -Learn- View Post
Yes, he integrated some sort of web browser in his application. But you can also see the theEye, theEar and Socket.cs too.
No, you can't. You just see them in the file tree, and open in tabs. You don't actually see the code, so unless you've actually used his program he could simply be lying.


At any rate, if I were you i'd start off by learning as much as I could about Windows sockets and TCP connections. Try making some basic TCP programs, making sure you learn important concepts for later (asynchronous sockets, multi-threading, ect). Once you have TCP & friends down you can try tackling LAN emulation.
Reply With Quote
  #12  
Old 05-09-2009, 02:27 PM
Qua's Avatar
QuaWant to Learn Lan Emulation Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Quote:
Originally Posted by -Learn- View Post
Yes, he integrated some sort of web browser in his application. But you can also see the theEye, theEar and Socket.cs too.

The application should not be that difficult, but for sure should first require some hard time of researches before starting.

---
Else, thanks for everyone's answers till now. But, for sure, I will still be happy for any type of guidance that could be useful to me.
I thought about about it. Without knowing it to be so, I would assume that when any computers starts to host a local WC3 game then every few seconds the UDP protocol is used to broadcast the existance of this game on the LAN to notify everyone residing with this network that the game has been created and are ready for clients to connect to it. Thus, other computers running WC3 in the network will be capable of showing the game in a list under LAN games and eventually join it.

Assuming that the system works as described above, then that poses the problem, but the solution lies within it just as well. The problem: Those broadcasts only happen on the LAN, so to make computers outside the host's LAN being able to see and join these game, you will need to broadcast those computers as well. I think this is where your program comes into the big picture. By sending out these broadcasts to individual computers, you can simulate them being on your LAN, even though they can be located anywhere on the internet.

To execute the method explained above, you would need two things:
  • The Ip of the computers that want to join the game;
  • The host needs to be able to communicate with the computers that wants to join the game to broadcast messages to them (which most likely will pose a problem due the reason mentioned by Rockoon in post #5 above).

I guess it would be possible, and perhaps more logical to have the computers that want to join actually asking the host for that broadcast instead of the other way around. By doing it in this order instead, you get around the problem of doing NAT-punching assuming that the host is actually capable of being a host (ie he has configured his router/firewalls ect).

Final note: All this assumes that the system works as described in the first paragraph, and if this is not the case then you'll most likely need another approach.
__________________
Reading is the foundation for all knowledge - Unknown.

Last edited by Qua; 05-09-2009 at 02:59 PM.
Reply With Quote
  #13  
Old 05-10-2009, 03:55 AM
-Learn- -Learn- is offline
Newcomer
 
Join Date: May 2009
Posts: 13
Default

Thanks 'Qua' for your big help.

Quote:
Originally Posted by Eradicator View Post
No, you can't. You just see them in the file tree, and open in tabs. You don't actually see the code, so unless you've actually used his program he could simply be lying.
Yes, I used his program, it works fine.
Reply With Quote
  #14  
Old 05-13-2009, 06:28 AM
-Learn- -Learn- is offline
Newcomer
 
Join Date: May 2009
Posts: 13
Default

Hi, I have been learning about sockets, async sockets, tcp, and udp over these few days and have also successfully created many client-server programs.
As expected, it was really interesting but I am currently learning more about udp, so don't blame me if some udp concepts are still not clear to me.

Yes returning to my original thread:

1. Assuming that wc3 uses the udp protocol to broadcast its game on the lan, is it possible to use some tools to see (/capture) these broadcasts? If so, what tools please?

2. My application should only run on the client side. How to I actually ask the host for that broadcast?
Do I need to send some broadcast packets to it first?


Ok, I'm currently learning more of udp, but any help/tips meanwhile would be nice.
Reply With Quote
  #15  
Old 05-13-2009, 07:41 AM
Eradicator Eradicator is offline
Junior Contributor
 
Join Date: May 2008
Posts: 300
Default

Quote:
Originally Posted by -Learn- View Post
1. Assuming that wc3 uses the udp protocol to broadcast its game on the lan, is it possible to use some tools to see (/capture) these broadcasts? If so, what tools please?
Sorry, no. Warcraft III runs on TCP connections.

http://us.blizzard.com/support/artic...l=true?rhtml=y

Quote:
Originally Posted by -Learn- View Post
2. My application should only run on the client side. How to I actually ask the host for that broadcast?
Do I need to send some broadcast packets to it first?
Yes. You need to send a packet to the host, and the host needs to track the IPs of each client (to send outgoing data). Basically, the host is a server like anything else.

Quote:
Originally Posted by -Learn- View Post
Ok, I'm currently learning more of udp, but any help/tips meanwhile would be nice.
You need to use TCP, not UDP.
Reply With Quote
  #16  
Old 05-13-2009, 09:08 AM
Qua's Avatar
QuaWant to Learn Lan Emulation Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Quote:
Originally Posted by Eradicator View Post
Sorry, no. Warcraft III runs on TCP connections.

http://us.blizzard.com/support/artic...l=true?rhtml=y



Yes. You need to send a packet to the host, and the host needs to track the IPs of each client (to send outgoing data). Basically, the host is a server like anything else.



You need to use TCP, not UDP.
Without having tested- or observed it myself, I am quite sure that when you host a local game the UDP protocol is used for the broadcast. Doing it any other way would not make sense, since you need a connection to all the computers you want to communicate with when using TCP, which would mean you would have to try to connect to every single IP on the subnet of your LAN to see if a connection could be made.

-Learn-, there are some very good packet sniffets for free. I would recommend Ethernal - now called Wireshark - which can be found here. It allows you to monitor all out- as well as ingoing traffic on your network cards. I believe it also has functionality to only monitor certain ports or protocols. A great tool really and very easy to use as well.

As for connecting to a host online that are hosting a LAN game. I'm not quite sure how it works, but perhaps sending a join packet to the server directly might work. You should monitor what happens when you try to connect to a game, or when a client connects to your game. The client should be sending some kind of packet implying that he wants to join the game. Once you have regonized and observed the format of this packet, you can simulate joining a game by manually sending this packet to the host.
__________________
Reading is the foundation for all knowledge - Unknown.

Last edited by Qua; 05-13-2009 at 09:25 AM.
Reply With Quote
  #17  
Old 05-13-2009, 11:16 AM
Eradicator Eradicator is offline
Junior Contributor
 
Join Date: May 2008
Posts: 300
Default

Quote:
Originally Posted by Qua View Post
Without having tested- or observed it myself, I am quite sure that when you host a local game the UDP protocol is used for the broadcast. Doing it any other way would not make sense, since you need a connection to all the computers you want to communicate with when using TCP, which would mean you would have to try to connect to every single IP on the subnet of your LAN to see if a connection could be made.
He's asking for a LAN emulator, which isn't actually local so i'd imagine it would be done with TCP. I'm not completely positive though, so I apologize if I was incorrect.
Reply With Quote
  #18  
Old 05-13-2009, 11:17 AM
Qua's Avatar
QuaWant to Learn Lan Emulation Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

To broadcast online you could use both TCP and UDP, udp properly being the easiest since a connection doesn't need to be established first, and once the connection process begins, WC3 will take care of the rest using TCP.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #19  
Old 05-13-2009, 12:41 PM
Rockoon's Avatar
Rockoon Rockoon is offline
Joseph Koss

* Guru *
 
Join Date: Aug 2003
Location: Unfashionable End
Posts: 3,615
Default

Sure, the emulation server can catch packets from various emulation clients over TCP/IP, but then what?

..how is it going to spoof the existance of *multiple* clients? Is there some way for a UDP packet to lie about its origins within the .NET framework? Arent all these spoofed packets going to appear to be comming from the same machine (because they are), ergo appear to be the same client?
Reply With Quote
  #20  
Old 05-13-2009, 01:29 PM
-Learn- -Learn- is offline
Newcomer
 
Join Date: May 2009
Posts: 13
Default

Thanks Qua for 'Wireshark'. I will check it later.

I written a small 'C#' application that:

1. Open a socket using udp,
2. Bind the IPEndPoint (255.255.255.255, 6112)
3. Cast it to EndPoint,
4. Receive data (loop method).

When I enter 'WC3 LAN', a packet is received once,
When I create a 'WC3 Game', every few secs packets are received.

-> You were right about udp broadcasts from WC3:

Look, I never created programs for LAN but only for Internet.
It seems that my program requires Internet connection.
Is a port reserved for Internet? or used for any type of connection?

I am not really sure why my program needs Internet to work?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation Want to Learn Lan Emulation
Want to Learn Lan Emulation
Want to Learn Lan Emulation
 
Want to Learn Lan Emulation
Want to Learn Lan Emulation
 
-->