Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Assets/Networking/NetworkingClient.cs(40,9): error CS8025: Parsing error

Discussion in 'Scripting' started by kiddliwink, Jul 24, 2014.

  1. kiddliwink

    kiddliwink

    Joined:
    Jul 24, 2014
    Posts:
    2
    Help! I dont know what to do so il just share my script!
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Sfs2X;
    4. using Sfs2X.Core;
    5. using Sfs2X.Requests;
    6. using Sfs2X.Entities;
    7.  
    8. public class NetworkingClient : MonoBehaviour {
    9.  
    10.     private string host = "localhost";            // The IP the client tried to connect to
    11.     private int port = 9933;                     // The port that the client tried to connect to the server as
    12.  
    13.     public SmartFox _client;
    14.    
    15.     // Use this for initialization
    16.     void Start () {
    17.         _client = new SmartFox();
    18.         _client.ThreadSafeMode = true;
    19.         _client.AddEventListener (SFSEvent.CONNECTION, OnConnection);
    20.         Connect ();
    21.     }
    22.    
    23.     // Update is called once per frame
    24.     void FixedUpdate () {
    25.         _client.ProcessEvents();
    26.     }
    27.  
    28.     public void Connect() {
    29.         _client.Connect (host, port:);
    30.     }
    31.  
    32.     void OnConnection(BaseEvent _event) {
    33.         if (bool)_event.Params["success"]) {
    34.             //Successful
    35.             Debug.Log ("Successfully connected to server");
    36.         } else {
    37.             //Failed
    38.             Debug.Log ("Failed connecting to server");
    39.         }
    40.     }
    41. }
     

    Attached Files:

  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Your line 33 has unbalanced parentheses. The closing parenthesis after bool is not needed.
     
  3. kiddliwink

    kiddliwink

    Joined:
    Jul 24, 2014
    Posts:
    2
    I removed it like you said and got another error:
    "All compiler errors have to be fixed before you can enter playmode!
    Unity.Editor.SceneView:ShowcompileErrorNotification()"
    So there's the error now heres the code after i did what you said:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Sfs2X;
    4. using Sfs2X.Core;
    5. using Sfs2X.Requests;
    6. using Sfs2X.Entities;
    7.  
    8. public class NetworkingClient : MonoBehaviour {
    9.  
    10.     private string host = "localhost";            // The IP the client tried to connect to
    11.     private int port = 9933;                     // The port that the client tried to connect to the server as
    12.  
    13.     public SmartFox _client;
    14.    
    15.     // Use this for initialization
    16.     void Start () {
    17.         _client = new SmartFox();
    18.         _client.ThreadSafeMode = true;
    19.         _client.AddEventListener (SFSEvent.CONNECTION, OnConnection);
    20.         Connect ();
    21.     }
    22.    
    23.     // Update is called once per frame
    24.     void FixedUpdate () {
    25.         _client.ProcessEvents();
    26.     }
    27.  
    28.     public void Connect() {
    29.         _client.Connect (host, port:);
    30.     }
    31.  
    32.     void OnConnection(BaseEvent _event) {
    33.         if (bool_event.Params["success"]) {
    34.             //Successful
    35.             Debug.Log ("Successfully connected to server");
    36.         } else {
    37.             //Failed
    38.             Debug.Log ("Failed connecting to server");
    39.         }
    40.     }
    41. }
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    What line does the compiler tell you has the problem?
     
  5. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,738
    I'm guessing line 29 shouldn't have that ":" in it.
     
  6. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    You're good.