Connect different project through networking
So what i basically is doing to connect two different project one for client and other for server. my basic idea of game is that my game is on server and it is control by an app which is client and late i will convert this app into android using unity build so for beginning and for simple understanding i have created 2 projects and in for project i have used two text field. on start of the function these two field as .setactive(false) and when server is started it show that field and when client connected to that server it show client side text field and on both project one button is these on click on that button it should start a server and client but in this server is connected but client never connect with it below is my script attached
//ServerSide script
using UnityEngine;
using System.Collections;
public class ServerSide : MonoBehaviour {
public GameObject text;
public int portno = 12345;
// Use this for initialization
void Start () {
text.SetActive(false);
}
// Update is called once per frame
void Update () {
}
public void server()
{
Network.InitializeServer(10, portno);
if(Network.peerType == NetworkPeerType.Server)
{
text.SetActive(true);
}
}
}
//clientSide script
using UnityEngine;
using System.Collections;
public class clientSide : MonoBehaviour {
public GameObject text;
public int portno = 12345;
public string ip ;
// Use this for initialization
void Start () {
text.SetActive(false);
}
// Update is called once per frame
void Update () {
}
public void client()
{
Network.Connect(ip,portno);
if(Network.peerType == NetworkPeerType.Client)
{
text.SetActive(true);
}
}
}
the button on server side is assigned function server and client side button is assigned with function client when is click on serve button server is started and this text filed show up and when i click clieent button nothing happens and when again i clicked server button on client side it show me this message "The server has disconnected from the client. Most likely the server has shut down." and of server side it show this error "A client which was not in the connected player list disconnected. ???" so plzz help me with this problem or suggest any other method to do this
Thanks in advance
Your answer
Follow this Question
Related Questions
Best way to learn Networking in general 0 Answers
Connecting SQL with Unity 0 Answers
What is difference between Network.InitializeServer and Unet. please help me 0 Answers
Warning: not all old messages was acknowledged 1 Answer
How should I verify that all of my client Object are created and ready after loading a new scene? 0 Answers