- Home /
Unity C# Sockets?
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.
Is there any particular reason you want to use raw sockets ins$$anonymous$$d of Unity built-in networking or some other higher level networking solution?
I'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
how 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?
Yes, 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.
Now 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
Answer by Malapropos · Dec 12, 2013 at 04:42 PM
Are 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?
I 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
If your connection details are all correct it should connect without problems. Can you show some of your code?
Never$$anonymous$$d 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
Answer by watsonsimler · Jun 02, 2014 at 07:24 AM
A simple socket programming example in c# for beginners....C# Socket programming
Watson
Your answer
![](https://koobas.hobune.stream/wayback/20220613124019im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Need help - Socket Server always connects to port 80 2 Answers
Data keeps "hanging". TCP client/server 2 Answers
Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference 0 Answers
Cannot connect to Unity3D master server from another device(computer) 0 Answers