- Home /
 
               Question by 
               Miti · Apr 10, 2016 at 11:18 AM · 
                networkingnetworkserverclient-server  
              
 
              how to use NetworkServer.SendToClient ?
Hi . i am not good at scripting so i need to know how to use NetworkServer.SendToClient to send a message to an specific client . for an example i want server send a message to a client and tell the client " hey this is server message" . please write an example . thanks for any reply .
server :
 void Start () {
         //Create a server 
         NetworkServer.Listen(8585);    
         NetworkServer.RegisterHandler(MsgType.Connect, OnConnected); 
         }
 void OnConnected(NetworkMessage netMsg) //if client connected
 {
     Debug.Log ("Client connected "+netMsg.conn.connectionId);
 }
client :
 public class NetClient: MonoBehaviour {
 NetworkClient myClient;
 public string ServerIP="127.0.0.1";
 public int ServerPort = 8585;
 public void Start() {
     myClient = new NetworkClient ();
     myClient.Connect(ServerIP, ServerPort);
         }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                