Hello everyone, I assuming this question has already been answered and I can’t seem to find it. How would one go at creating a offline LAN using the c# sockets, is there any tutorials? Any help would be greatly appreciated.
2 Answers
2Are the machines in network with each of them having assigned IP address? If so, you could just use Unity built in networking and there is no need to go so low level as raw sockets.
Some good material that helped me get started with Unity networking:
http://www.palladiumgames.net/tutorials/unity-networking-tutorial/
http://docs.unity3d.com/Documentation/Components/NetworkReferenceGuide.html
http://cgcookie.com/unity/2011/12/20/introduction-to-networking-in-unity/
Just use local network IP instead of public one that is shown to the outside world.
also going to ask this if others might have this issue but is the facilitator unity embedded, cause I create the offline server and it says connect to facilitator at xx.xxx.xxx.xx port. would I have others connect to this ip address?
– Guardian2300I am having issues with it being offline. I can't get clients to connect to the IpAddress associated with Network.player.Ipaddress. I keep getting an error about the connection request to ip address and port failed are you sure the server can be connected to. I'm not connecting to the server I'm creating my own
– Guardian2300If your connection details are all correct it should connect without problems. Can you show some of your code?
– MalaproposNevermind to note if the useNat is set to true then it searches on unity servers for the facilitator which results in the connection not working. I got it to work. Thanks very much
– Guardian2300A simple socket programming example in c# for beginners…C# Socket programming
Watson
Is there any particular reason you want to use raw sockets instead of Unity built-in networking or some other higher level networking solution?
– MalaproposI'm trying to design the game to where you can connect to each others computer without the need of internet. Example would be like system linking between consoles
– Guardian2300how would you start the server then, would you use network.initializeserver and the local network ip would be the one displayed on computer using ipconfig in cmd?
– Guardian2300Yes, that should work. I've tested same kind of setup within local university network. If you can access the router config you should be able to see which IP it has assigned to which machine that way too.
– MalaproposNow if I bought a router and didn't hook it up to the internet and had everyone just hook up to the router would that work too. This is also for a College purpose and avoiding the schools network
– Guardian2300